Super User Asked by HankerPL on December 16, 2021
I need just basename cmd to be executed on 2’nd column
[ora@rac TEST]$ cat test.log | awk '{print $1 " " $2}'
9780c69e13e3dda64c3c6ddce2b37803 /test/test_202007140422_01.zip
73b635c2e852e215a342cba53a323b80 /test/test_202007140422_02.zip
c194efd0fc6381c2a5a92913dae572d6 /test/test_202007140422_03.zip
I need something like this:
9780c69e13e3dda64c3c6ddce2b37803 test_202007140422_01.zip
73b635c2e852e215a342cba53a323b80 test_202007140422_02.zip
c194efd0fc6381c2a5a92913dae572d6 test_202007140422_03.zip
I prefer awk but you can use diff tool if it simple works;)
Thanks in advance.
Use space OR slash as the field separator, and print the first and last fields:
awk -F '[[:blank:]/]' '{print $1, $NF}' file
Answered by glenn jackman on December 16, 2021
I used this one:
while IFS=" " read -r f c; do echo $f $(basename $c); done < test.log
and it works for me;) If you have better idea - please post it below;)
Answered by HankerPL on December 16, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP