12-25-2008
Quote:
Originally Posted by
Lakris
Hi, If I knew that the number of lines in the source file was limited, I would do it the lazy way,
something like
grep -A9999 C myfile.txt
(meaning: include the 9999 lines following "C" in the output)
but I'm sure someone here soon will supply a solution in sed or awk, it's a common enough question.
/Lakris
thanks.
however, in my case, the grep shows -A as an illegel option.
i m on solaris:
grep: illegal option -- A
Usage: grep -hblcnsviw pattern file . . .
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi ,
could any one suggest me that how to determine if the first field is numeric and if it is greater than another number then from that point everything else should be printed using awk.
I have tried this
:
awk -v xxxx=$xxxxx '
BEGIN {
enable=0
}
{
print $1
if ( ( $1 !~ "^*$" ... (5 Replies)
Discussion started by: hitmansilentass
5 Replies
2. Shell Programming and Scripting
Hi all,
I have 2 files. One contains only 1 column and other one contains 2 columns, let say 1_col.txt and 2_col.txt respectively. Here, I will try to explain with an example.
Input files :
1_col.txt 2_col.txt
a a b
x a c
p ... (5 Replies)
Discussion started by: AshwaniSharma09
5 Replies
3. Shell Programming and Scripting
Hello all, please help. There are two file like this:
file1:
1197510.0 294777.7 9666973.0 21.6 1839.8
1197510.0 294777.7 9666973.0 413.2 2075.9
1197510.0 294777.7 9666973.0 689.3 2260.0
... (1 Reply)
Discussion started by: attila
1 Replies
4. Shell Programming and Scripting
Hi All,
I have to match each row in file 1 with 1st row in file 2 and print the corresponding column from file2. I am trying to use an awk script to do this. For example
cat File1
X1
X3
X4
cat File2
ID X1 X2 X3 X4
A 1 6 2 1
B 2 7 3 3
C 3 8 4 1
D 4 9 1 1 (3 Replies)
Discussion started by: newpro
3 Replies
5. UNIX for Advanced & Expert Users
Hi
I am checking status of sftp in Health check script, sftp command is used to connect the server with secure RSA key, which is successfully get connected most of the time but in some case if RSA key ask for password then I need to exit sftp command after few second and continue to run... (1 Reply)
Discussion started by: ketanraut
1 Replies
6. Shell Programming and Scripting
Hi, all
I need your help and suggestions.
I want to print particular strings in a field of a csv file and show them in terminal. Here is an example of the csv file.
SourceFile,Airspeed,GPSLatitude,GPSLongitude,Temperature,Pressure,Altitude,Roll,Pitch,Yaw... (7 Replies)
Discussion started by: refrain
7 Replies
7. Shell Programming and Scripting
Want to get the remaining line after pattern match Here it starts - executed commands : - pattern to identify 100:27:500:1:34:END
Required output:100:27:500:1:34:END
awk '{if(/pattern to identify/) print $2}' < file
I have used above code and it not giving... (3 Replies)
Discussion started by: rozee
3 Replies
8. Shell Programming and Scripting
Hi All,
I am having a text file like below
ERROR - Not a valid
ID : 123
ERROR - Not a valid
hello
ID : 124
SUCCESS - Valid
ID : 12
I need to display like below after reading the file if it finds the error keyword
along with displaying this first line when error pattern... (10 Replies)
Discussion started by: rohit_shinez
10 Replies
9. Shell Programming and Scripting
Hello there
I'd like to make a copy of 2nd column and have it printed in place of column 1. Remaining columns are needed as it.
test data:
ProbeSet GeneSymbol X22565285 X22566285
ILMN_1050008 MYOCD 6.577 7.395
ILMN_1050014 GPRC6A 6.595 6.668
ILMN_1050017 ... (2 Replies)
Discussion started by: genome
2 Replies
10. Shell Programming and Scripting
Hello Folks,
I have an requirement, where i need to get total count of the file based on creation date with there filename selected pattern.
Filename: MobileProtocol.20171228T154200.157115.udr
I want to get the count of files created on each day based on a pattern find.
find . -type... (7 Replies)
Discussion started by: sadique.manzar
7 Replies
ZGREP(1) General Commands Manual ZGREP(1)
NAME
zgrep - search possibly compressed files for a regular expression
SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename...
DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code:
(-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the
standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep.
If the GREP environment variable is set, zgrep uses it as the grep program to be invoked.
EXIT CODE
2 - An option that is not supported was specified.
AUTHOR
Charles Levert (charles@comm.polymtl.ca)
SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1)
ZGREP(1)