Sponsored Content
Top Forums Shell Programming and Scripting Split a file into multiple files based on the input pattern Post 302488283 by abinash on Sunday 16th of January 2011 01:08:02 PM
Old 01-16-2011
Thanks for the reply. It is working well.
But I am extremely sorry for not explaining my requirement clearly.

The example will look like
Code:
......test message.....
some junk letters......123_start....to fill this line
......
.......
some junk.....123_end...bla..bla..
....
.....
......test message.....
some junk letters......456_start....to fill this line
......
.......
some junk.....456_end...bla..bla..
....
.....
......test message.....
some junk letters......789_start....to fill this line
......
.......
some junk.....789_end...bla..bla..
....
.....

The output is expected to be in 123 file as follows.

Code:
some junk letters......123_start....to fill this line
......
.......
some junk.....123_end...bla..bla..


Last edited by Scott; 01-16-2011 at 02:17 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

split XML file into multiple files based on pattern

Hello, I am using awk to split a file into multiple files using command: nawk '{ if ( $1 == "<process" ) { n=split($2, arr, "\""); file=arr } print > file }' processes.xml <process name="Process1.process"> ... (3 Replies)
Discussion started by: chiru_h
3 Replies

2. Shell Programming and Scripting

Split a file into multiple files based on field value

Hi, I've one requirement. I have to split one comma delimited file into multiple files based on one of the column values. How can I achieve this Unix Here is the sample data. In this case I have split the files based on date column(c4) Input file c1,c2,c3,c4,c5... (1 Reply)
Discussion started by: manasvi24
1 Replies

3. Shell Programming and Scripting

Split single file into multiple files using pattern matching

I have one single shown below and I need to break each ST|850 & SE to separate file using unix script. Below example should create 3 files. We can use ST & SE to filter as these field names will remain same. Please advice with the unix code. ST|850 BEG|PO|1234 LIN|1|23 SE|4 ST|850... (3 Replies)
Discussion started by: prasadm
3 Replies

4. Shell Programming and Scripting

Split: File into multiple and keeping the same 3 lines from input into all output files

The following code will split the infile into multiple files. However, I need it to insert the same first 3 lines from the original input file into each splitted file. How do I modify my script below to do so: print -n "Enter file name to split? " ; read infile if then echo "Invalid file... (4 Replies)
Discussion started by: mrn6430
4 Replies

5. Shell Programming and Scripting

Help needed - Split large file into smaller files based on pattern match

Help needed urgently please. I have a large file - a few hundred thousand lines. Sample CP START ACCOUNT 1234556 name 1 CP END ACCOUNT CP START ACCOUNT 2224444 name 1 CP END ACCOUNT CP START ACCOUNT 333344444 name 1 CP END ACCOUNT I need to split this file each time "CP START... (7 Replies)
Discussion started by: frustrated1
7 Replies

6. Shell Programming and Scripting

Split a big file into multiple files based on first four characters

I have a requirement to split a huge file to smaller text files based on first four characters which look like ABCD 1234 DFGH RREX : : : : : 0000 Each of these records are OF EQUAL bytes with a different internal layout based on the above first digit identifier.. Any help to start... (5 Replies)
Discussion started by: etldev
5 Replies

7. UNIX for Dummies Questions & Answers

Split a huge 7 GB File Based on Pattern into 4 files

Hi, I have a Huge 7 GB file which has around 1 million records, i want to split this file into 4 files to contain around 250k messages each. Please help me as Split command cannot work here as it might miss tags.. Format of the file is as below <!--###### ###### START-->... (6 Replies)
Discussion started by: KishM
6 Replies

8. Shell Programming and Scripting

Split a text file into multiple pages based on pattern

Hi, I have a text file (attached the sample). I have also, attached the way the way the files need to be split. We get this file, that will either have 24 Jurisdictions, or will miss some and retain some. Like in the attached sample file, there are only Jurisdictions 03,11,14,15, 20 and 30.... (3 Replies)
Discussion started by: ebsus
3 Replies

9. Shell Programming and Scripting

Split a single file into multiple files based on a value.

Hi All, I have the sales_data.csv file in the directory as below. SDDCCR; SOM ; MD6546474777 ;05-JAN-16 ABC ; KIRAN ; CB789 ;04-JAN-16 ABC ; RAMANA; KS566767477747 ;06-JAN-16 ABC ; KAMESH; A33535335 ;04-JAN-16 SDDCCR; DINESH; GD6674474747 ;08-JAN-16... (4 Replies)
Discussion started by: ROCK_PLSQL
4 Replies

10. UNIX for Beginners Questions & Answers

Split file into multiple files based on empty lines

I am using below code to split files based on blank lines but it does not work. awk 'BEGIN{i=0}{RS="";}{x="F"++i;}{print > x;}' Your help would be highly appreciated find attachment of sample.txt file (2 Replies)
Discussion started by: imranrasheedamu
2 Replies
eFTE(1) 						      General Commands Manual							   eFTE(1)

NAME
efte - Text editor SYNOPSIS
efte [[options] files ...] vefte [[options] files ...] nefte [[options] files ...] DESCRIPTION
This manual page documents briefly the efte. This manual page was written for the Debian GNU/Linux distribution (but may be used by others), because the original program does not have a manual page. Instead, it has documentation in html format; see below. efte is a powerful text editor which closely resembles Borlands programming editors for M$-DOS, but is far more flexible and configurable. OPTIONS
efte uses a command line syntax, which is a little bit different from most of Debian GNU/Linux apps. -h -? --help Help on command line options. -! Ignore any external configuration file and use internal configuration. -l<line>[,<column>] Go to line (and column) in next file on command line. -#<line>[<,column>] Same as -l. Do not use this option. -m[<mode>] Set mode for next files to <mode>. If just plain -m, then use default mode. -C[<.cnf>] Use specified configuration file (compiled). Plain -C does the same as -!. -D[<.dsk>] Load/save desktop from file <.dsk>. If no argument, disable desktop load/save. -H[<.his>] Load/save history from file <.his>. If no argument, disable history load/save. -T<tagfile> Load 'tagfile' at startup. -t<tag> Lookup tag 'tag' and display file containing it. -- The rest of the arguments are not options, but filenames. -+ The next argument is not an option even if starting with a '-'. Useful when loading files that begin with a -. -noxmb Do not use XMB functions in xefte - useful if you have incorrect locales and you want to use just english fonts. -font Select XWindow font to use with xefte. See VIOFONT also. ENVIRONMENTAL VARIABLES
This is list of variable which might change behavior of some internals of efte. VIOFONT - select font used by xefte ISOCONSOLE - when set, vefte is usign ascii symbols to draw tables. This is useful when iso latin charset is used on console. EXAMPLES
efte -mBIN /usr/bin/vefte load /usr/bin/vefte in BIN mode efte -mBIN -+ -bla- load file -bla- in BIN mode efte -l100,30 win.c go to (100,30) in win.c efte window.cpp load file window.cpp efte -- -1 -2 -3 -4 -5 -6 load files -1, -2, -3, -4, -5, -6 efte -D -H efte.dsk efte.his disable desktop and history loading and saving and load files efte.dsk and efte.his FILES
~/.efterc /usr/local/etc/efte/system.fterc /etc/efte/system.fterc Default configuration files. Includes all keybindings and menus compiled with cefte(1) from config files in /usr/share/doc/efte/config- example.tar.gz. SEE ALSO
cefte(1), /usr/share/doc/efte/contents.html AUTHORS
This manual page was written by Riku Voipio and Zdenek Kabelac <riku.voipio@iki.fi> <kabi@debian.org> for the Debian GNU/Linux system. DATE
18 Nov 1999 eFTE(1)
All times are GMT -4. The time now is 03:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy