10-30-2008
How to print lines till till a pattern is matched in loop
Dear All
I have a file like this
112534554
446538656
444695656
225696966
226569744
228787874
113536566
443533535
222564552
115464656
225445345
225533234
I want to cut the file into different parts where the first two columns are '11' . The first two columns will be either 11, 22,44 or 66.
I want the output to be directed to three files named serially like f001, f002, f003.......like this
cat f001
112534554
446538656
444695656
225696966
226569744
228787874
cat f002
113536566
443533535
222564552
cat f003
115464656
225445345
225533234
How can i put this in a loop till the end of read of my input file......
Please help.....
Regards
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Is there any way to print all the string till we get a space and a number and store it a variable
for eg we have string java.io.IOException: An existing connection was forcibly closed by the remote host 12
All I want is to store "java.io.IOException: An existing connection was forcibly closed... (13 Replies)
Discussion started by: villain41
13 Replies
2. Shell Programming and Scripting
Hi All,
I want to remove first few characthers from starting of the line till ',' Comma... which needs to be done for all the lines in the file
Eg:
File content
1,"1234",emp1,1234
2,"2345",emp2,2345
Expected output is
,"1234",emp1,1234
,"2345",emp2,2345
How can parse... (4 Replies)
Discussion started by: kiranlalka
4 Replies
3. Shell Programming and Scripting
i have a file which contains alphanumeric data in every line. what i need is the data after certain pattern. the data after the pattern is not of fixed length so i need the data till the space after the pattern.
Input file:
bfdkasfbdfg khffkf lkdhfhdf pattern (datarequired data not required)... (2 Replies)
Discussion started by: gpk_newbie
2 Replies
4. Shell Programming and Scripting
Hi ,
I want to print file till line number 33 and stdout to different file.
I have used cat -n <file name> which numbers the lines including blank line.
now how can i stdout the first 33 lines in to new file.
Regards
newaix (6 Replies)
Discussion started by: newaix
6 Replies
5. Shell Programming and Scripting
Hi,
I have got the below requirement. please suggest.
I have a file like,
Processing Item is:
/data/ing/cfg2/abc.txt
/data/ing/cfg3/bgc.txt
Processing Item is:
/data/cmd/for2/ght.txt
/data/kernal/config.klgt.txt
I want to process the above file to get the output file like,
... (5 Replies)
Discussion started by: rbalaj16
5 Replies
6. Shell Programming and Scripting
I have a file which is like this
………………………………………..
…………………………………
…………………………………
……………………………………
…………………………………….
………………………………
<<<from_here>>>
………………………………
……………………………….
I want a script which would fetch the data starting from <<<from_here>>> in the file till the end... (2 Replies)
Discussion started by: halfafringe
2 Replies
7. Shell Programming and Scripting
I need help to put a script where it runs the svn command grep'ing for the ticket# in the comments to see if the ticket was used in the latest commit.
so on command line:
./test.sh ticket-1 ticket-2 ticket-3
It should be able to check if ticket-1 is used first and if not then check if... (2 Replies)
Discussion started by: iaav
2 Replies
8. Shell Programming and Scripting
Need assistance in writing a for loop script or any looping method. Below is the code where i can get all the files from the URL . There are about 80 files in the URL .Every day the files get updated . Script that i wanted is the loop must keep on running till it gets 80 files. It matches the count... (5 Replies)
Discussion started by: ajayram_arya
5 Replies
9. Shell Programming and Scripting
I have the following code:
# Get the line of stations_info.txt starting with "${xstation1} " and copy it to file temp.txt
grep "^${xstation1} " stations_info.txt > temp.txt
# Get lat and long of station
nl=0
... (2 Replies)
Discussion started by: claire.a
2 Replies
10. Shell Programming and Scripting
I need help with extract/print lines till stop pattern. This needs to happen after every 3rd occurrence of start pattern and continue till end of file. Consider below is an example of the log file. my start pattern will be every 3rd occurrence of ERROR_FILE_NOT_FOUND and stop pattern will be... (5 Replies)
Discussion started by: NSS
5 Replies
GZEXE(1) General Commands Manual GZEXE(1)
NAME
gzexe - compress executable files in place
SYNOPSIS
gzexe [ name ... ]
DESCRIPTION
The gzexe utility allows you to compress executables in place and have them automatically uncompress and execute when you run them (at a
penalty in performance). For example if you execute ``gzexe /bin/cat'' it will create the following two files:
-r-xr-xr-x 1 root bin 9644 Feb 11 11:16 /bin/cat
-r-xr-xr-x 1 bin bin 24576 Nov 23 13:21 /bin/cat~
/bin/cat~ is the original file and /bin/cat is the self-uncompressing executable file. You can remove /bin/cat~ once you are sure that
/bin/cat works properly.
This utility is most useful on systems with very small disks.
OPTIONS
-d Decompress the given executables instead of compressing them.
SEE ALSO
gzip(1), znew(1), zmore(1), zcmp(1), zforce(1)
CAVEATS
The compressed executable is a shell script. This may create some security holes. In particular, the compressed executable relies on the
PATH environment variable to find gzip and some other utilities (tail, chmod, ln, sleep).
BUGS
gzexe attempts to retain the original file attributes on the compressed executable, but you may have to fix them manually in some cases,
using chmod or chown.
GZEXE(1)