Sponsored Content
Top Forums Shell Programming and Scripting Print previous, current and next line using sed Post 302247854 by jim mcnamara on Thursday 16th of October 2008 12:58:59 PM
Old 10-16-2008
Code:
sed -n -e '/Failure/{x;1!p;g;$!N;p;D;}' -e h  inputfilename

This User Gave Thanks to jim mcnamara For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to use sed to search for string and Print previous two lines and current line

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)
Discussion started by: nmadhuhb
1 Replies

2. Shell Programming and Scripting

how Print previous line ..........

HELLO...I wanted to ask you, than sure know unix more than me, as I can obtain the following solution: I have a file with rows of the type: CIAO COME STAI PERCHE COME STAI CIAO COME VA ALLO CHE FACCIAMO ................. I would that if in a line is present the word (for example) " CHE... (9 Replies)
Discussion started by: fabi20
9 Replies

3. UNIX for Dummies Questions & Answers

print previous month (current month minus 1) with Solaris date and ksh

Hi folks month=`date +%m`gives current month Howto print previous month (current month minus 1) with Solaris date and ksh (7 Replies)
Discussion started by: slashdotweenie
7 Replies

4. Shell Programming and Scripting

Print the previous line

My requirement is that when ever search criteria matchs in log file, the previous line just above the search word as well as search word should be print. sample log file --03-19T11:26 xxx create version "a.sh@@/main/6" "104157 " --03-18T16:01 xxx create version "a.sh@@/main/5" ... (6 Replies)
Discussion started by: jadoo_c2
6 Replies

5. UNIX for Dummies Questions & Answers

Awk to print data from current and previous line

Hi guys, I have found your forum super useful. However, right now I am stuck on a seemingly "simple" thing in AWK. I have two columns of data, the first column in Age (in million years) and the second column is Convergence Rate (in mm/yr). I am trying to process my data so I can use it to... (2 Replies)
Discussion started by: awk_noob_456
2 Replies

6. Shell Programming and Scripting

Perl: Conditional replace based on previous and current value in a line

I need to read the contents of a file. Then I need to grep for a keyword and replace part of the grepped line based on the condition of previous and present line. Example input file: V { port1 = P; port2 = 0; shift_port = P0; /* if next shift_port is P0 I need... (9 Replies)
Discussion started by: naveen@
9 Replies

7. Shell Programming and Scripting

Sed Comparing Parenthesized Values In Previous Line To Current Line

I am trying to delete lines in archived Apache httpd logs Each line has the pattern: <ip-address> - - <date-time> <document-request-URL> <http-response> <size-of-req'd-doc> <referring-document-URL> This pattern is shown in the example of 6 lines from the log in the code box below. These 6... (1 Reply)
Discussion started by: Proteomist
1 Replies

8. Shell Programming and Scripting

awk script -print line when $2 > $2 of previous line

Hi all, From a while loop I am reading a sorted file where I want to print only the lines that have $1 match and $2 only when the difference from $2 from the previous line is > 30. Input would be like ... AN237 010 193019 0502 1 CSU Amoxycillin AN237 080 ... (2 Replies)
Discussion started by: gafoleyo73
2 Replies

9. Shell Programming and Scripting

How to print previous line of multiple pattern matched line?

Hello, I have below format log file, Comparing csv_converted_files/2201/9747.1012H67126.5077292103609547345.csv and csv_converted_files/22019/97447.1012H67126.5077292103609547345.csv Comparing csv_converted_files/2559/9447.1012H67126.5077292103609547345.csv and... (6 Replies)
Discussion started by: arvindshukla81
6 Replies

10. UNIX for Beginners Questions & Answers

awk or sed to print the character from the previous line after the regexp match

Hi All, I need to print the characters in the previous line just before the regular expression match Please have a look at the input file as attached I need to match the regular expression ^ with the character of the previous like and also the pin numbers and the output file should be like... (6 Replies)
Discussion started by: kshitij
6 Replies
frog(1) 						      General Commands Manual							   frog(1)

NAME
frog - Dutch morpho-syntactic analyzer, IOB chunker and dependency parser SYNOPSYS
frog [options] frog -t test-file DESCRIPTION
frog is an integration of memory-based natural language processing (NLP) modules developed for Dutch. frog's current version will tok- enize, tag, lemmatize, and morphologically segment word tokens in Dutch text files, add IOB chunks and will assign a dependency graph to each sentence. OPTIONS
-c <configfile> set the configuration using 'file' -d <level> set debug level. -e <encoding> set input encoding. (default UTF8) -h give some help --keep-parser-files=[yes|no] keep the intermediate files from the parser. Last sentence only! -n assume inputfile to hold one sentence per line -o <file> send output to 'file' instead of stdout. Defaults to the name of the inputfile with '.out' appended. --outputdir <dir> send all output to 'dir' instead of stdout. Creates filenames from the inputfilename(s) with '.out' appended. --skip=[mptc] skip parts of the proces: Tokenizer (t), Chunker (c), Multi-Word unit (m) or Parser (p) -Q Enable quotedetection in the tokenizer. May run havock! -S <port> Run a server on 'port' -t <file> process 'file' -x <xmlfile> process 'xmlfile', which is supposed to be in FoLiA format! If 'xmlfile' is empty, and --testdir=<dir> is provided, all files in 'dir' will be processed as FoLia XML. --testdir=<dir> process all files in 'dir'. see also --outputdir --tmpdir=<dir> location to store intermediate files. Default /tmp. -V or --version show version info --xmldir=<dir> generate FoLiA XML output and send it to 'dir'. Creates filenames from the inputfilename with '.xml' appended. -X <file> generate FoLiA XML output and send it to 'file'. Defaults to the name of the inputfile(s) with '.xml' appended. --id=<id> When -X for FoLia is given, use 'id' to give the doc an ID. BUGS
likely AUTHORS
Maarten van Gompel proycon@anaproy.nl Ko van der Sloot Timbl@uvt.nl Antal van den Bosch Timbl@uvt.nl SEE ALSO
ucto(1) 2012 January 31 frog(1)
All times are GMT -4. The time now is 03:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy