![]() |
Hello and Welcome from 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 |
| [help]Delete or replace text in multiple file and multiple directory | dzufauzan | Shell Programming and Scripting | 16 | 06-05-2009 12:07 PM |
| Delete repeated word in text file | vincyoxy | Shell Programming and Scripting | 6 | 03-26-2009 04:10 AM |
| c program to extract text between two delimiters from some text file | kukretiabhi13 | High Level Programming | 7 | 12-03-2008 06:29 PM |
| How to extract data from a text file | negixx | Shell Programming and Scripting | 1 | 07-19-2005 10:30 PM |
| Huge (repeated Entry) text files | axl | SUN Solaris | 4 | 07-16-2004 08:05 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Extract multiple repeated data from a text file
Hi,
I need to extract data from a text file in which data has a pattern. I need to extract all repeated pattern and then save it to different files. example: input is: Code:
ST*867*000352214 BPT*00*1000352214*090311 SE*1*1 ST*867*000352215 BPT*00*1000352214*090311 SE*1*2 ST*867*000352216 BPT*00*1000352214*090311 SE*1*3 first file: Code:
ST*867*000352214 BPT*00*1000352214*090311 SE*1*1 Code:
ST*867*000352215 BPT*00*1000352214*090311 SE*1*2 Code:
ST*867*000352216 BPT*00*1000352214*090311 SE*1*3 Can anybody please help me to put me close to solution? Thanks in advance. Regards, Neeraj Last edited by Yogesh Sawant; 04-13-2009 at 08:10 AM.. Reason: added code tags |
|
||||
|
Code:
awk '/^ST/{++i}{print > "file" i}' textfile
Code:
/^ST/{++i}
Code:
{print > "file" i}
Regards |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|