![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| any better way to remove line breaks | csmklee | Shell Programming and Scripting | 3 | 01-13-2009 02:42 AM |
| 'exec /bin/sh' breaks alias | stulincoln | Shell Programming and Scripting | 1 | 05-29-2008 12:00 PM |
| Help on page breaks | simhasuri | Shell Programming and Scripting | 1 | 01-31-2008 04:51 PM |
| Newbie ? Need Help with If/Then & Line Breaks... | kthatch | UNIX for Dummies Questions & Answers | 1 | 05-01-2007 07:44 PM |
| Page Breaks | rama71 | High Level Programming | 9 | 06-29-2005 12:28 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Fix the breaks
The file FTP'd got few breaks and the data looks like:
ABCTOM NYMANAGER ABCDAVE NJ PROGRAMMER ABCJIM CTTECHLEAD ABCPETERCA HR and i want the output like: ABCTOM NYMANAGER ABCDAVE NJPROGRAMMER ABCJIM CTTECHLEAD ABCPETERCAHR can you please help me in writing the shell script to fix these broken lines. Every line is supposed to start with 'ABC' (key positions). Also the break is always at the 11th position and continues on the next line at 4th position.. Thanks |
|
||||
|
Or in good old sed:
command: Code:
sed ':a;$!N;/\nABC/!s/\n//;ta;P;D' file Code:
ABCTOM NYMANAGER ABCDAVE NJ PROGRAMMER ABCJIM CTTECHLEAD ABCPETERCA HR Code:
ABCTOM NYMANAGER ABCDAVE NJPROGRAMMER ABCJIM CTTECHLEAD ABCPETERCAHR |
|
||||
|
i am getting the following errors!!.. Please advise
awk '{printf (NR==1)?$0:/^'ABC'/?RS$0:$0}END{print eof}' file awk: syntax error near line 1 awk: illegal statement near line 1 sed ':a;$!N;/\nABC/!s/\n//;ta;P;D' file Label too long: :a;$!N;/\nABC/!s/\n//;ta;P;D |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|