Recently a small operation has to be done on Linux:
is to print the path of all pictures in a folder and the corresponding file name to a TXT file, forming a list-like thing.
First, here's a command to know: awk
Awk is actually a powerful text analysis tool that reads the file line-by-row (awk is processing each line), slices each row with a space as the default delimiter, and then makes various analytical processing of the cut.
Specific Use method:
' {pattern + action} ' {Filenames}
Back to my question, that's how it's done:
First go to the folder directory I want to work with,
Then typed the following command:
Here, "Train" is the folder I want to work with (all pictures inside), "| "This symbol is a pipe, inside the single quotation mark, the first thing that follows in curly braces can be referred to as" condition ", followed by an absolute path, and a double quote followed by" $ "means that all columns in this row are processed.
PS: If $ $ represents the first column, and so on.
And then we'll see what's inside of 1.txt.
At this point, we successfully print out the absolute path of all the pictures in the folder ~
[Linux operations] awk operation print Picture path