Suppose I have a file which contains other file names with some extention [.dat,.sum etc].
text file containt
gdsds sd8ef g/f/temp_temp.sum yyeta t/unix.sum
ghfp hrwer h/y/test.text.dat
if[-r h/y/somefile.dat] then....
I want to get the complete file names, like for above file I should get output as
temp_temp.sum
unix.sum
test.text.dat
somefile.dat
I am using AIX unix in which grep -ow [a-zA-Z_] filename is not working as for AIX -o switch is not present.
# Convert all characters but a-zA-Z0-9_/. into spaces.
# Then convert all spaces into newlines.
sed 's/[^a-zA-Z0-9_/.]/ /g;s/ /\n/g' < file |
# Print the token after the last /. Ignore lines with no / in them.
awk -F/ 'NF>1 { print $NF }'
---------- Post updated at 01:16 PM ---------- Previous update was at 01:15 PM ----------