awk '{print $2}' <fileName> did the trick
I didn't know that a pathname like /usr/share/icons/Papirus/16x16/actions/address-book-new.svg will be considered a single column
So, i just got the second column printed using the above awk command
Brilliant!
Yes, it will do as long as there are NO SPACES in the file names.
And, the file name is considered a single column as long as it doesn't have field separators in it, i.e. you don't define awk 's FS to be (or contain) / .
There are of course several other approaches as well, e.g.:
Thank You Rudic
The 2 solutions you've provided for the full-blown spec have one minor issue. The word "file" is also printed as the shown the output
But, I just need the filepath name
I think the same as obviously RudiC does: perhaps the empty spaces are not what they seem to be (tabs instead of spaces or the like). Modify your code above to:
sed 's/^file[[:space:]]*//; s/[[:space:]]*conflict.*$//' <filename>
to get some additional variability. Notice that the regexp "[[:space:]]*" will cover for tabs (or any other form of whitespace) instead of spaces and the asterisk will make sure that these are completely removed even if there are several (instead of the expected one) of them. i.e. this line: