06-23-2009
Grep multiple lines from a file
Hi,
I would like to ask if there is any method to grep a chuck of lines based on the latest file in a directory.
E.g
Latest file in the directory:
Line 1: 532243
Line 2: 123456
Line 3: 334566
Line 4: 44567545
I wanted to grep all the line after line 2 i.e. Line 3 and line 4 and then writing them in a file.
Cheers
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I 'm trying to grep 2 fieldds on 2 differnt lines. Like this:
psit > file
egrep -e '(NS|ES)' $file. Not working. If this succeeds then run next cmd else exit. Pls Help
Gundu (13 Replies)
Discussion started by: gundu
13 Replies
2. Shell Programming and Scripting
Hi.
I have this format on a textfile:
VG Name /dev/vg00
PV Name /dev/dsk/c16t0d0
PV Name /dev/dsk/c18t0d0
PV Name /dev/dsk/c16t4d0
VG Name /dev/vg01
PV Name ... (6 Replies)
Discussion started by: jOOc
6 Replies
3. AIX
I have setof files with data and with same fields multiple times in each of the files.
for example:
file 1
name = mary kate
last name = kate
address = 123
street = abc
name = mary mark
last name = mark
address = 456
street = bcd
file 2
name = mary kate
last name = kate... (2 Replies)
Discussion started by: relearner
2 Replies
4. Shell Programming and Scripting
Sir
I have a data file e.g. DATA31082009. This file consists of several data files appended to that file. The size of each data file is different. The first line of each file starts with "44". I want to grep data from "44" to the preceding line of next "44" and save it as a individual file.... (10 Replies)
Discussion started by: chssastry
10 Replies
5. UNIX for Dummies Questions & Answers
I want to search files (basically .cc files) in /xx folder and subfolders.
Those files (*.cc files) must contain #include "header.h" AND x() function.
I am writing it another way to make it clear,
I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings, header.h... (2 Replies)
Discussion started by: ritikaSharma
2 Replies
6. UNIX for Dummies Questions & Answers
hi
i have kind of below text in a file.
I want to get a complete paragraph starting with START and ending with before another START) which has a particular string say XYZ or ABC
START XYZ hshjghkjh 45 ljkfd
fldjlj d jldf
START 3493u ABC 454
4545454
4545454 45454
4545454
START ...... (3 Replies)
Discussion started by: reldb
3 Replies
7. UNIX for Advanced & Expert Users
How do you grep 'select * from table_name' string from a script if the select * and from table_name are on 2 different lines ? like
select *
from table_name
Any help would be greatly appreciated !!!
Thanks
RDR (4 Replies)
Discussion started by: RDR
4 Replies
8. UNIX for Dummies Questions & Answers
I want to grep multiple lines from a text file. I want to grep all lines containing X,Y and NA in a single command. How do I go about doing that?
This is what my text files look like:
rs1983866 0.0983 10 100016313
rs1983865 0.5994 X 100016339
rs1983864 0.3272 11 100017453
rs7077266... (2 Replies)
Discussion started by: evelibertine
2 Replies
9. UNIX for Dummies Questions & Answers
I would like to use grep to select multiple lines from a text file using a single-column text file. Basically I want to only select lines from the first text file where the second column of the first text file matches the second text file. How do I go about doing that? Thanks! (5 Replies)
Discussion started by: evelibertine
5 Replies
10. Shell Programming and Scripting
GM,
I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed.
I am assuming that sed, awk or even perl could do what I need.
I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Discussion started by: jxfish2
7 Replies
LEARN ABOUT LINUX
erl_comment_scan
erl_comment_scan(3erl) Erlang Module Definition erl_comment_scan(3erl)
NAME
erl_comment_scan - Functions for reading comment lines from Erlang source code.
DESCRIPTION
Functions for reading comment lines from Erlang source code.
DATA TYPES
comment() = {integer(), integer(), integer(), [string()]} :
EXPORTS
file(FileName::filename() (see module file)) -> [Comment]
Types Comment = {Line, Column, Indentation, Text}
Line = integer()
Column = integer()
Indentation = integer()
Text = [string()]
Extracts comments from an Erlang source code file. Returns a list of entries representing multi-line comments, listed in order of
increasing line-numbers. For each entry, Text is a list of strings representing the consecutive comment lines in top-down order; the
strings contain all characters following (but not including) the first comment-introducing % character on the line, up to (but not
including) the line-terminating newline.
Furthermore, Line is the line number and Column the left column of the comment (i.e., the column of the comment-introducing % char-
acter). Indent is the indentation (or padding), measured in character positions between the last non-whitespace character before the
comment (or the left margin), and the left column of the comment. Line and Column are always positive integers, and Indentation is a
nonnegative integer.
Evaluation exits with reason {read, Reason} if a read error occurred, where Reason is an atom corresponding to a Posix error code;
see the module file(3erl) for details.
join_lines(Lines::[CommentLine]) -> [Comment]
Types CommentLine = {Line, Column, Indent, string()}
Line = integer()
Column = integer()
Indent = integer()
Comment = {Line, Column, Indent, Text}
Text = [string()]
Joins individual comment lines into multi-line comments. The input is a list of entries representing individual comment lines, in
order of decreasing line-numbers ; see scan_lines/1 for details. The result is a list of entries representing multi-line comments,
still listed in order of decreasing line-numbers , but where for each entry, Text is a list of consecutive comment lines in order of
increasing line-numbers (i.e., top-down).
See also: scan_lines/1 .
scan_lines(Text::string()) -> [CommentLine]
Types CommentLine = {Line, Column, Indent, Text}
Line = integer()
Column = integer()
Indent = integer()
Text = string()
Extracts individual comment lines from a source code string. Returns a list of comment lines found in the text, listed in order of
decreasing line-numbers, i.e., the last comment line in the input is first in the resulting list. Text is a single string, contain-
ing all characters following (but not including) the first comment-introducing % character on the line, up to (but not including)
the line-terminating newline. For details on Line , Column and Indent , see file/1 .
string(Text::string()) -> [Comment]
Types Comment = {Line, Column, Indentation, Text}
Line = integer()
Column = integer()
Indentation = integer()
Text = [string()]
Extracts comments from a string containing Erlang source code. Except for reading directly from a string, the behaviour is the same
as for file/1 .
See also: file/1 .
AUTHORS
Richard Carlsson <richardc@it.uu.se >
syntax_tools 1.6.7 erl_comment_scan(3erl)