LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   awk/grep/sed/print......etc (https://www.linuxquestions.org/questions/linux-newbie-8/awk-grep-sed-print-etc-4175421081/)

dotran 08-08-2012 04:26 PM

awk/grep/sed/print......etc
 
The abc.txt file always 2 lines.
cat abc.txt
21321313
34343dfddf

Please help...what’s good command out put like below 1 line. The 2 lines come first then first line. Thanks

34343dfddf 21321313

This code not code not work:

Quote:

cat abc.txt | awk 'NR==2,NR==1' | tr -d '\n'

Ser Olmy 08-08-2012 04:38 PM

This should work:
Code:

cat abc.txt | tr '\n' ' ' | awk '{print $2,$1}'

dotran 08-08-2012 04:41 PM

Awesome....Thanks very much.


All times are GMT -5. The time now is 05:07 AM.