LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 04-25-2012, 10:28 AM   #1
hjorge_2001
LQ Newbie
 
Registered: Apr 2012
Posts: 1

Rep: Reputation: Disabled
Programming in AWK


Hi everybody,

I'm new in AWK programer. So i need help for this: I need to trasnformer this text below in one line.

----------------------------------------------------
1002965811
1002965811 HENRIQUE SOUZA SILVA
002965811 R RIO VERDE
002965811 NOVO AGUA LIMP
002965811 999.899.222-33
+002965811 4.0129.0001.088-9
2002965813 073
002965813 096
002965813 06,0000
002965813 1,22200
002965813 1,00000
002965813
002965813
002965813 MF02S
002965813 094 / 025
002965813 310
002965813 0129-5

transform in one line like this:
--------------------------------------------------
HENRIQUE SOUZA SILVA 99989922233 4012900010889 01295

Thank you
 
Old 04-25-2012, 10:49 AM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Look at the 'tr' command not awk for this.

Pipe your output to this:

Code:
tr '\n' ' '
If \n doesn't work try \r.

Last edited by colucix; 04-25-2012 at 11:34 AM. Reason: Fixed CODE tags
 
Old 04-25-2012, 11:12 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
How about you tell us how the data in the output is related? Otherwise we will assume that there is no reason and simply extract lines based on there position in the file, ie. line 2, 5, 6, 17
 
  


Reply



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] The AWK programming Language huaihaizi3 Programming 4 03-22-2011 10:04 AM
[SOLVED] Help in using 'awk' programming........ apanimesh061 Programming 8 11-21-2010 09:06 AM
Using wildcard in awk programming, how ? sarajevo Programming 2 10-18-2006 07:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:35 AM.

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