|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Converting column to rows for every 3 lines in the column
Hi gurus! Please help me with this one. I have an file with the following contents: Code:
a b c d e f g h i j I would like to make to transform it to look like this as my output file: Code:
a,b,c d,e,f g,h,i j So for every 3 lines of the input file is read, that three lines of the column will converted into a comma delimited row. This should be done for every 3 lines until it reaches the end of the input file. Any thoughts of using awk? Thanks in advance!
|
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
Code:
$ paste -d, - - - < infile a,b,c d,e,f g,h,i j,, |
| The Following 2 Users Say Thank You to Scrutinizer For This Useful Post: | ||
47shailesh (05-21-2012), kokoro (05-23-2012) | ||
|
#5
|
|||
|
|||
|
thanks guys! all of these worked for me.
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Converting rows to column | sagar_1986 | Shell Programming and Scripting | 4 | 05-04-2012 02:07 AM |
| Converting entries from rows to column | atulkakrana | Shell Programming and Scripting | 2 | 02-17-2012 02:59 AM |
| command for converting 4 column data to 1 column | rpf | Shell Programming and Scripting | 5 | 12-12-2011 10:40 AM |
| Converting Single Column into Multiple rows | laknar | Shell Programming and Scripting | 3 | 01-24-2009 09:40 AM |
| Converting Column to Rows in a Flat file | srinikal | Shell Programming and Scripting | 5 | 10-10-2008 03:32 PM |
|
|