11-23-2009
Shell Script to identify the line number containing a particular "string"
Hi,
I have a log file, where i am required to identify the line number, where a particular string/line appears in the log file.
And then copy 200 lines above that line number to a new file.
Can someone provide pointers on how to write this script or what command to be used ?
Any help would be highly appreciated.
Thanks in advnace,
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
2. Shell Programming and Scripting
Hi All,
How can i replace '"|\n" with new line in shell script?
Thanks!
vaskar (8 Replies)
Discussion started by: vaskarbasak
8 Replies
3. UNIX for Dummies Questions & Answers
Hello, can any one help me on this?
I have a /etc/exports file, it may contain a line (I can not remember exactly). Let me use an a sample file myfile.txt which contains a line
* mypattern uncertain key words
I want this line (with any possible combination of the uncertain key words to be... (2 Replies)
Discussion started by: Dingrong
2 Replies
4. AIX
Hi,
This is odd, however here goes. There are several shell scripts that run in our production environment AIX 595 LPAR m/c, which has sufficient memory 14GB (physical memory) and horsepower 5CPUs. However from time to time we get the following errors in these shell scripts. The time when these... (11 Replies)
Discussion started by: jerardfjay
11 Replies
5. HP-UX
Hi,
I have a log file, where i am required to identify the line number, where a particular string/line appears in the log file.
And then copy 200 lines above that line number to a new file.
Can someone provide pointers on how to write this script or what command to be used ?
Any... (1 Reply)
Discussion started by: kk2202
1 Replies
6. Shell Programming and Scripting
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Discussion started by: shis100
7 Replies
7. Shell Programming and Scripting
Hi,
when i grep for the process "XYZ" , there will be some good number of processes with that name, i want to kill all the these processes at a time using shell script?
Any help needed for this action.
Thanks
Regards,
Anil (6 Replies)
Discussion started by: anilmanepu
6 Replies
8. Shell Programming and Scripting
logs:
"/home/abc/public_html/index.php"
"/home/abc/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
how to use "cut" or "awk" or "sed" to get the following result:
abc
abc
xyz
xyz
xyz (8 Replies)
Discussion started by: timmywong
8 Replies
9. Shell Programming and Scripting
Dear Ladies & Gents,
I have a requirement to delete all the log files in /var/log/test directory that are older than 10 days and their first line begin with "MSH" or "<?xml" or "FHS". I've put together the following BASH script, but it's erroring out:
for filename in $(find /var/log/test... (2 Replies)
Discussion started by: Hiroshi
2 Replies
10. Shell Programming and Scripting
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
LEARN ABOUT DEBIAN
iprop-log
IPROP-LOG(8) BSD System Manager's Manual IPROP-LOG(8)
NAME
iprop-log -- maintain the iprop log file
SYNOPSIS
iprop-log [--version] [-h | --help] command
iprop-log truncate [-c file | --config-file=file] [-r string | --realm=string] [-h | --help]
iprop-log dump [-c file | --config-file=file] [-r string | --realm=string] [-h | --help]
iprop-log replay [--start-version=version-number] [--end-version=version-number] [-c file | --config-file=file] [-r string | --realm=string]
[-h | --help]
DESCRIPTION
Supported options:
--version
-h, --help
command can be one of the following:
truncate
-c file, --config-file=file
configuration file
-r string, --realm=string
realm
Truncates the log. Sets the new logs version number for the to the last entry of the old log. If the log is truncted by emptying
the file, the log will start over at the first version (0).
dump
-c file, --config-file=file
configuration file
-r string, --realm=string
realm
Print out all entries in the log to standard output.
replay
--start-version=version-number
start replay with this version
--end-version=version-number
end replay with this version
-c file, --config-file=file
configuration file
-r string, --realm=string
realm
Replay the changes from specified entries (or all if none is specified) in the transaction log to the database.
last-version
-c file, --config-file=file
configuration file
-r string, --realm=string
realm
prints the version of the last log entry.
SEE ALSO
iprop(8)
Heimdal February 18, 2007 Heimdal