Hi to all,
I'm an awk newbie.
I have a text file like this:
aaa /home/smith/subfolder1/filename1.ext1 bbb
ccc /home/smith/subfolder1/subfolder2/filename2.ext2 ddd
eee /home/smith/subfolder1/filename3.ext3 fff
::::
I should extract (for further parsing) the filenames above: in other words
the substrings between the LAST slash '/' (excluded) and the last space ' '
(excluded)
filename1.ext1
filename2.ext2
filename3.ext3
:::::
thanks a lot
Marco
|
|
0
|
|
|
|
Reply
|
Marco
|
5/21/2004 9:33:21 PM |
|
Marco Meoni wrote:
> Hi to all,
> I'm an awk newbie.
>
> I have a text file like this:
>
> aaa /home/smith/subfolder1/filename1.ext1 bbb
> ccc /home/smith/subfolder1/subfolder2/filename2.ext2 ddd
> eee /home/smith/subfolder1/filename3.ext3 fff
> ::::
>
> I should extract (for further parsing) the filenames above: in other words
> the substrings between the LAST slash '/' (excluded) and the last space ' '
> (excluded)
>
> filename1.ext1
> filename2.ext2
> filename3.ext3
> :::::
>
> thanks a lot
>
> Marco
>
awk -F '[ /]' '{print $(NF-1)}'
Regards,
Ed.
|
|
0
|
|
|
|
Reply
|
Ed
|
5/21/2004 9:35:28 PM
|
|