String search and print next all lines in one line until blank line
Dear all
I want to search special string in file and then print next all line in one line until blank lines come. Help me plz for same. My input file and desire op file is as under.
i/p file:
op file2 line)
Thanks in advance.
Regards
Jaydeep Sadaria
Last edited by Scrutinizer; 08-24-2013 at 09:08 AM..
Reason: code tags
Hello,
Can anybody help me to correct my sed syntax to find the string and print previous two lines and current line and next one line.
i am using string as "testing"
netstat -v | sed -n -e '/test/{x;2!p;g;$!N;p;D;}' -e h
i am able to get the previous line current line next line but... (1 Reply)
Hi,
I would like to know how to solve one of my problems using expert unix commands.
I have a file with occasional blank lines;
for example;
dertu
frthu
fghtu
frtty
frtgy
frgtui
frgtu
ghrye
frhutp
frjuf
I need to edit the file so that the file looks like this; (10 Replies)
Hi Guys,
I need to search a string and print the rest of the lines...
input: 8 0 90 1 0 59 20 2488 96 30006dde372 S ? 0:00 /etc/opt/SUNWconn/atm/bin/atmsnmpd -n
output: 00 /etc/opt/SUNWconn/atm/bin/atmsnmpd -n
Actually i don even need the first "00".. any suggestions is appreciated..... (13 Replies)
I have multiple config files where I need to pull the ip address from loopback3. The format is the same in every file, the ip is the second line after interface loopback3.
interface loopback2 loopback
description router ID
ip address 192.168.1.1
interface loopback3 loopback
description... (3 Replies)
All I want is to look for the pattern in the file...If I found it at # places... I want print lines after those pattern(line) until I find a blank line.
Log EXAMPLE :
MT:Exception caught
The following Numbers were affected:
1234
2345
2346
Error
java.lang.InternalError:... (3 Replies)
Hi Guys,
I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same.
can anyone of you please let me know how to go about it ? (8 Replies)
Hi Folks
I need a one liner to parse through a log and if the string is found print the line above, the line with the string and the line below.
example:
The ball is green and blue
Billy through the ball higer.
Jane got hurt with the ball.
So if I search for Billy I would need the 3... (1 Reply)
Hi,
I have a file, say files_list, as below (o/p of ls -R cmd)
$ cat files_list
/remote/dir/path/to/file:
sub-dir1
sub-dir2
sub-dir3
...
/remote/dir/path/to/file/sub-dir1:
remote_file1.csv.tgz
<blank line 1>
/remote/dir/path/to/file/sub-dir2:
remote_file2.csv.tgz
<blank... (3 Replies)
I have a text file ( basically a log file) and i have 2 words (alpha, beta),
Now i want to search these two words in one line and then print next 15 lines in a temp file. there would be many lines with alpha and beta But I need only last occurrence with "alpha" and "beta" and next 15 lines.
... (4 Replies)
if the first string matches then print the previous line and current line and also print the following lines if the other string search matches.
Input
------
TranTime 2012 10 12
The Record starts here
Accountnumber: 4632473431274
TxnCode 323
TranID 329473242834
ccsdkcnsdncskd... (7 Replies)
Discussion started by: laknar
7 Replies
LEARN ABOUT DEBIAN
anacrontab
ANACRONTAB(5) Anacron Users' Manual ANACRONTAB(5)NAME
/etc/anacrontab - configuration file for anacron
DESCRIPTION
The file /etc/anacrontab describes the jobs controlled by anacron(8). Its lines can be of three kinds: job-description lines, environment
assignments, or empty lines.
Job-description lines are of one of these two forms:
period delay job-identifier command
@period_name delay job-identify command
The period is specified in days, the delay in minutes. The job-identifier can contain any non-blank character, except slashes. It is used
to identify the job in Anacron messages, and as the name for the job's timestamp file. The command can be any shell command. The fields
can be separated by blank spaces or tabs. The period_name can only be set to monthly at the present time. This will ensure jobs are only
run once a month, no matter the number of days in this month, or the previous month.
Environment assignment lines are of the form:
VAR = VALUE
Spaces around VAR are removed. No spaces around VALUE are allowed (unless you want them to be part of the value). The assignment takes
effect from the next line to the end of the file, or to the next assignment of the same variable.
Empty lines are either blank lines, line containing white-space only, or lines with white-space followed by a '#' followed by an arbitrary
comment.
You can continue a line onto the next line by ending it with a ''.
SEE ALSO anacron(8)
The Anacron README file.
AUTHOR
Itai Tzur <itzur@actcom.co.il>
Currently maintained by Pascal Hakim <pasc@(debian.org|redellipse.net)>.
Pascal Hakim 2004-07-11 ANACRONTAB(5)