The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
To convert multi format file to a readable ascii format gaur.deepti UNIX for Dummies Questions & Answers 5 03-25-2008 12:03 PM
Need help to format a file ratheesh Shell Programming and Scripting 2 02-13-2008 03:04 PM
Convert UTF8 Format file to ANSI format rajreddy UNIX for Dummies Questions & Answers 9 05-25-2007 05:26 AM
Convert UTF8 Format file to ANSI format rajreddy UNIX for Advanced & Expert Users 1 05-24-2007 03:40 AM
man format file trynew Shell Programming and Scripting 3 10-07-2004 12:17 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-01-2005
Registered User
 

Join Date: Feb 2002
Posts: 56
file format....

I have a file of 1000 rows , I need to format it to be coulmn seperatred by TAB , and print it

Ex:

12345
12345
12343
32232
23432
34242
43224

to like

12345 TAB 12345
12343 TAB 32232
23432 TAB 34242
43224 TAB .........

Thanks alot for your helping and care...
Reply With Quote
Forum Sponsor
  #2  
Old 07-01-2005
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
paste - - < inputfile

default output delimiter is a tab....

cheers
ZB
Reply With Quote
  #3  
Old 07-01-2005
Registered User
 

Join Date: Feb 2002
Posts: 56
Sed...

Can be processed using sed...????

Thanks,,
Atiato
Reply With Quote
  #4  
Old 07-01-2005
Registered User
 

Join Date: May 2005
Posts: 46
Using sed

Quote:
Originally Posted by atiato
Can be processed using sed...????

Thanks,,
Atiato

Code :-

sed 's/^\([0-9]*\)/\1 \1/' inputfile
Reply With Quote
  #5  
Old 07-01-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
Code:
sed "$!N;s/\n/$(/bin/echo '\t')/" inputFile
Reply With Quote
  #6  
Old 07-01-2005
Registered User
 

Join Date: May 2005
Posts: 46
Can u explain this :-

Quote:
Originally Posted by vgersh99
Code:
sed "$!N;s/\n/$(/bin/echo '\t')/" inputFile

Vgresh ,

Can u plz explain that ...
Reply With Quote
  #7  
Old 07-01-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,699
Quote:
Originally Posted by vgersh99
Code:
sed "$!N;s/\n/$(/bin/echo '\t')/" inputFile
Could you explain your sed script, please ?

Thanks,
vino
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0