Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-08-2012, 05:26 PM   #1
LQ Newbie
Registered: Apr 2012
Posts: 27
Blog Entries: 2

Rep: Reputation: Disabled

The abc.txt file always 2 lines.
cat abc.txt

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:

cat abc.txt | awk 'NR==2,NR==1' | tr -d '\n'
Old 08-08-2012, 05:38 PM   #2
Ser Olmy
Senior Member
Registered: Jan 2012
Distribution: Slackware
Posts: 3,318

Rep: Reputation: Disabled
This should work:
cat abc.txt | tr '\n' ' ' | awk '{print $2,$1}'
Old 08-08-2012, 05:41 PM   #3
LQ Newbie
Registered: Apr 2012
Posts: 27

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
Awesome....Thanks very much.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] replace grep -o with sed or awk nicomoresi Linux - Newbie 20 08-08-2011 12:13 PM
[SOLVED] bash- sed, awk, grep schneidz Programming 10 01-31-2011 09:56 PM
grep help or sed or awk dmchess Linux - Software 4 09-29-2010 07:53 PM
[SOLVED] Help using awk,sed and grep shakes82 Programming 34 07-08-2010 12:12 AM
help with grep/sed/awk nikunjbadjatya Programming 8 02-17-2010 08:29 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration