![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Break one line to many lines using awk | pinnacle | Shell Programming and Scripting | 16 | 06-01-2009 03:05 AM |
| Awk 2 lines to 1 line | pinnacle | Shell Programming and Scripting | 7 | 04-23-2009 08:51 AM |
| cat file1 read line-per-line then grep -A 15 lines down in fileb | irongeekio | Shell Programming and Scripting | 6 | 01-28-2009 06:30 AM |
| Joining lines in reverse. append line 1 to line 2. | dwalley | Shell Programming and Scripting | 7 | 08-04-2008 08:11 AM |
| Appending line number to each line and getting total number of lines | chiru_h | Shell Programming and Scripting | 2 | 03-25-2008 10:19 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
New line after every 3 lines
Hi all, My file is of below format: Code:
abc,111,222,333 xyz,398,399,834 jdj,398,947,487 nmn,535,33,34 sss,43,3,53 ks,343,3,4 d,94,94999 I want to insert 2 rows(NULL,0,0,0) after every 3 lines. shown as below: o/p: Code:
abc,111,222,333 xyz,398,399,834 jdj,398,947,487 NULL,0,0,0 NULL,0,0,0 nmn,535,33,34 sss,43,3,53 ks,343,3,4 NULL,0,0,0 NULL,0,0,0 d,94,94999 could anyone help me ? ![]() Use CODE-tags when displaying code, data or logs to enhance readability and to preserve formatting like indention etc., ty. Last edited by zaxxon; 07-21-2009 at 05:57 AM.. Reason: code tags |
|
||||
|
Thanks zaxxon.
A slight change, My file is of below format: abc,111,222,333,jjj,22 xyz,398,399,834,ww,33 jdj,398,947,487,eee,44 abc,535,33,34,jjj,22 sss,43,3,53,dd,ter,33 ks,343,3,4,jsj,33 d,94,94999,re,ere cc,33,53453,xd,22 abx,343,33,jjj,55 As we can see in 5th column, "jjj", the number of rows between two jjj shoud be 7. the o/p should be as : abc,111,222,333,jjj,22 xyz,398,399,834,ww,33 jdj,398,947,487,eee,44 NULL,0,0,0,0,0 NULL,0,0,0,0,0 NULL,0,0,0,0,0 NULL,0,0,0,0,0 abc,535,33,34,jjj,22 sss,43,3,53,dd,ter,33 ks,343,3,4,jsj,33 d,94,94999,re,ere cc,33,53453,xd,22 NULL,0,0,0,0,0 NULL,0,0,0,0,0 abx,343,33,jjj,55 could anyone help me ? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|