![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| usage of module Text::Wrap; | trek | Shell Programming and Scripting | 3 | 06-04-2008 11:08 PM |
| word wrap issue with grep | bowtiextreme | HP-UX | 4 | 04-30-2008 04:39 PM |
| SCO acquisition wrap-up | iBot | UNIX and Linux RSS News | 0 | 02-19-2008 01:30 PM |
| Wrap Interactive Script | meskue | Shell Programming and Scripting | 0 | 06-23-2006 03:21 PM |
| word wrap in vi | dangral | UNIX for Dummies Questions & Answers | 3 | 10-30-2002 10:45 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi,
This is my first time post a new thread. I have been trying to work on this for the past 2 days and could not find any good solution. I have 1 long long line ( EDI wrapped file) like below: NEW*SR*04411763447*279*278*Q~*ZR*AAV*SR*04511763460*SQ*21B37F04~HL*305*304*Q~K~SN1*1*1*SR*0551176346 1* and so on...all in 1 long line. I need to extract certain pattern =grep 'SR\*[0-9]\{11\}\*' ( example SR*04411763447*) and remove others and put it to output file like: SR*04411763447* SR*04511763460* SR*05511763461* . . etc. I tried use grep and sed..but have no luck working on wrap file. Please help. Last edited by vanda_25; 05-03-2006 at 10:17 AM. |
| Forum Sponsor | ||
|
|
|
|||
|
I've been working with X12 documents for the last year and a half and finally wrote a C program to print out the segments one per line. However, a nice quick-and-dirty trick is to convert the segment terminator (usually, but not always, a tilde) to a newline.
# cat file | tr '~' '\n' | grep 'SR\*[0-9]\{11\}\*' |