Grep range of lines to print a line number on match
Hi Guru's,
I am trying to grep a range of line numbers (based on match) and then look for another match which starts with a special character '$' and print the line number. I have the below code but it is actually printing the line number counting starting from the first line of the range i am looking in.
I actually want it to print the line number of this match (starting with $ symbol) with a range of lines from a file.
an example match could be $x,xxx.xx but not always the same in the length.
Hello
I need some help with this job.
file.txt
----- cut ----
TARGET
13/11/08
20:43:21
POINT 1
MOVE 8
772102y64312417771
TARGET
13/11/08
21:10:01
POINT 2
MOVE 5
731623jjd12njhd
----- cut ----
this is the example.
i need to grep for the word TARGET and print next 4 lines like... (1 Reply)
Hello
I have a silly question. I need to grep a match in text file
and then print 5 lines after it.
grep -A 5 .... do it.
OK
The next thing I can not handle is I need each output to be on 1 line
match line2 line3 line4 line5
match line2 line3 line4 line5
etc..
I will really... (10 Replies)
Hi,
Anyone help me to print the lines from the flat file between 879th line number and 1424th line number.
The 879 and 1424 should be passed as input to the shell script(It should be dynamic).
Can any one give me using sed or awk?
I tried using read, and print the lines..Its taking too... (3 Replies)
Hi all,
on Solaris 10, I'd like to print a range of lines starting at pattern but also including the very first line before pattern.
the following doesn't print the range starting at pattern and going down to the end of file: cat <my file> | sed -n -e '/<pattern>{x;p;}/'
I need to include the... (1 Reply)
Hi,
I have a file as below
This is the line one
This is the line two
<\XMLTAG>
This is the line three
This is the line four
<\XMLTAG>
Output of the SED command need to be as below.
This is the line one
This is the line two
<\XMLTAG>
Please do the need to needful to... (4 Replies)
Data:
Pattern Data Data Data
Data Data Data
Data Data Data
...
With awk, how do I print the pattern matching line, then the subsequent lines following the pattern matching line. Varying number of lines following the pattern matching line. (9 Replies)
Hi,
I have a simple problem but i guess stupid enough to figure it out. i have thousands rows of data. and i need to find match patterns of two columns and print the number of rows. for example:
inputfile
abd abp 123
abc abc 325
ndc ndc 451
mjk lkj... (3 Replies)
I need to fetch particular string from log file based on grep condition match.
Actual requirement is need to print the next word from the same line based on grep string condtion match.
File :Java.lanag.xyz......File copied completed : abc.txt
Ouput :abc.txt
I have used below... (5 Replies)
Hi ,
My record file , need to print up to above (DATA array)(there may be n no lines ) , grep "myvalue" row now .....suggest me some options
--- DATA Array---
record type xxxxx
sequence type yyyyy
2
3---> data1
/dev/
--- DEVICE ---
MAXIMUM_People=
data_blocks=
MY_value=2
xyz
abc ... (0 Replies)
Hi,
I have attached an output file which is some kind of database file mapping. It is basically like an allocation mapping of a tablespace and its datafile/s.
The output is generated by the SQL script that I found from 401 Authorization Required
Excerpts of the file are as below:
... (2 Replies)
Discussion started by: newbie_01
2 Replies
LEARN ABOUT DEBIAN
qwavcut
qwavcut(1) quelcom man pages qwavcut(1)NAME
qwavcut - extract and/or delete parts of a wav file
SYNOPSIS
qwavcut [option]... file
DESCRIPTION
qwavcut allows to extract and/or delete a fragment of a wav file. some parameters must be supplied in order to define the start/size/end
cut points and what to do then: either the fragment must be copied to another file or erased from the file (or both)
GENERAL OPTIONS -d, --delete
deletes the fragment from the file. if option --output is used, deletion action is always done after fragment extraction.
-h, --help
show a brief help and exit.
-o <outfile>, --output=<outfile>
outfile is the file where the samples contained in the specified cut will be copied.
-V, --version
show version and exit.
CUT OPTIONS
cut options are used to specify at which sample the fragment begins (options -b or -B), ends (options -e and -E), or which size it has
(option -s). at least, one cut option must be specified. neither the options -b and -B, and the options -e and -E can be used together;
also, a begin, end and size option can be used at the same time.
by default, the fragment begins at the first sample and ends at the last sample; there's no default value for size.
all the values are treated as a sample number unless a format specifier is used. see the FORMATS section below for information. all values
must be positive integer.
-b <begin>[<format>], --set-begin-from-eof=<begin>[<format>]
begin specifies the first sample of the file that belongs to the cut counting from the end of the file.
-B <begin>[<format>], --set-begin=<begin>[<format>]
begin specifies the first sample of the file that belongs to the cut counting from the beginning of the file.
-e <end>[<format>], --set-end-from-eof=<end>[<format>]
end specifies the last sample of the file that belongs to the cut counting from the end of the file.
-E <end>[<format>], --set-end=<end>[<format>]
end specifies the last sample of the file that belongs to the cut counting from the beginning of the file.
-s <size>[<format>], --set-size=<size>[<format>]
size specifies the number of samples contained in the cut.
-S <begin>-<end>, --slice <begin>-<end>
slice specifies the starting and ending points of the cut as a timeslice, which is to say, two time specifications ([[h:]m:]s[.ms])
joined by a hyphen.
FORMATS
cut options can have also an optional modifier. if this modifier is not used, then the value provided with the corresponding cut option
will be interpreted as a number of samples. since most of the times will be difficult to specify a cut in terms of samples, the following
modifiers are provided:
j value is interpreted as milliseconds.
m value is interpreted as minutes.
s value is interpreted as seconds.
b value is interpreted as bytes.
k value is interpreted as kbytes (1024 bytes).
M value is interpreted as megabytes (1024 kbytes).
in either case, the values specified will be rounded to get an integer number of samples.
EXAMPLES
here are some examples:
to get the last ten seconds of a file:
qwavcut -b 10s -o outfile.wav infile.wav
four ways of getting the first minute of a file:
qwavcut -S -1:0 -o outfile.wav infile.wav
qwavcut -S -60 -o outfile.wav infile.wav
qwavcut -E 1m -o outfile.wav infile.wav
qwavcut -s 1m -o outfile.wav infile.wav
four ways of getting the second quarter of a file:
qwavcut -S 15:0-30:0 -o outfile.wav infile.wav
qwavcut -B 15m -E 30m -o outfile.wav infile.wav
qwavcut -s 15m -E 30m -o outfile.wav infile.wav
qwavcut -B 15m -s 15m -o outfile.wav infile.wav
NOTES
if neither the options --output nor --delete are specified, the program will do nothing.
when cutting at the end, a simple truncate call is needed. but when cutting in the middle or in the beginning, all the data behind the cut
must be moved ahead and, depending on the amount of the data to be moved, this can be a time consuming operation.
BUGS
tests has been done only with 44100 Hz 16 bit stereo files, though it may work with mono/stereo 8/16 bits files.
AUTHOR
dmanye@etse.urv.es
http://www.etse.urv.es/~dmanye/quelcom/quelcom.html
SEE ALSO qwavinfo(1), qwavjoin(1), qwavsilence(1), qwavfade(1), qwavheaderdump(1)qmp3info(1), qmp3join(1), qmp3cut(1), qmp3check(1), qmp3report(1)quelcom 0.4.0 february 2001 qwavcut(1)