Sponsored Content
Top Forums Shell Programming and Scripting Any solution to get previous line in awk Post 302844351 by krishmaths on Sunday 18th of August 2013 11:51:42 PM
Old 08-19-2013
Hi Jotne,

Could you please explain the code?

Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk;sed appending line to previous line....

I know this has been asked before but I just can't parse the syntax as explained. I have a set of files that has user information spread out over two lines that I wish to merge into one: User1NameLast User1NameFirst User1Address E-Mail:User1email User2NameLast User2NameFirst User2Address... (11 Replies)
Discussion started by: walkerwheeler
11 Replies

2. Shell Programming and Scripting

Awk script to create new file based on previous line

Need help creating a script that does the following: Sort a file Compare the previous line "last field" with current line "last field" If they are the same, print output to a file If they are different print output to a new file The script should keep creating new files if the previous... (5 Replies)
Discussion started by: Muga801
5 Replies

3. Shell Programming and Scripting

awk get matched line's previous line

hi everyone, a b in c d e f in g output is: a e so awk search for "in", then print out the matched line's previuos line. Please advice. (11 Replies)
Discussion started by: jimmy_y
11 Replies

4. Shell Programming and Scripting

Awk help with source and previous line loop

Hello, I've written a ksh awk script to ping multiple servers and write the results to a file. That part is working ok. I then want to extract the names of only the server which are available. This is indicated by '1 packets received'. The server name actually appears above that line so I found... (4 Replies)
Discussion started by: Grueben
4 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

Read column values from previous and next line using awk

Hi, I have a csv file which contains data that looks something like this: Key1 Key2 Key3 New_Key1 New_Key2 New_Key3 102 30 0 - - - 102 40 1 30 40 50 102 50 2 40 50 ... (4 Replies)
Discussion started by: Nishi_Licious
4 Replies

7. Shell Programming and Scripting

Remove previous line if next & previous lines have same 4th character.

I want to remove commands having no output. In below text file. bash-3.2$ cat abc_do_it.txt grpg10so>show trunk group all status grpg11so>show trunk group all status grpg12so>show trunk group all status GCPKNYAIGT73IMO 1440 1345 0 0 94 0 0 INSERVICE 93% 0%... (4 Replies)
Discussion started by: Raza Ali
4 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

awk to insert line previous to a pattern?

I have a very long line with certain patters embedded in there. I need to be able to read that line, and when it encounters that pattern, create a new line. I want the pattern to be the beginning of the new line. I thought sed or awk could do this, but everything I try in sed gives me a "sed... (2 Replies)
Discussion started by: Drenhead
2 Replies

10. Shell Programming and Scripting

awk to copy previous line matching a particular columns

Hello Help, 2356798 7689867 999 000 123678 20385907 9797 666 17978975 87468976 968978 98798 I am trying to have out put which actually look for the third column value of 9797 and then it insert line there after with first, second column value exactly as the previous line and replace the third... (3 Replies)
Discussion started by: Indra2011
3 Replies
MENHIR(1)						      General Commands Manual							 MENHIR(1)

NAME
menhir - parser generator for OCaml SYNOPSIS
menhir [options] files DESCRIPTION
menhir is a LR(1) parser generator for the Objective Caml programming language. That is, Menhir compiles LR(1) grammar specifications down to Objective Caml code. It is mostly compatible with ocamlyacc(1). OPTIONS
-h, --help Show summary of options. -b, --base basename Specifies a base name for the output file(s). --comment Include comments in the generated code. --depend Invoke ocamldep and display dependencies. --dump Describe the automaton in basename.automaton. --error-recovery Attempt recovery by discarding tokens after errors. --explain Explain conflicts in basename.conflicts. --external-tokens module Import token type definition from module. --graph Write grammar's dependency graph to basename.dot. --infer Invoke ocamlc for ahead of time type inference. --interpret Interpret the sentences provided on stdin. --interpret-show-cst Show a concrete syntax tree upon acceptance. -la, --log-automaton level Log information about the automaton. -lc, --log-code level Log information about the generated code. -lg, --log-grammar level Log information about the grammar. --no-inline Ignore the %inline keyword. --no-stdlib Do not load the standard library. --ocamlc command Specifies how ocamlc should be invoked. --ocamldep command Specifies how ocamldep should be invoked. --only-preprocess Print a simplified grammar and exit. --only-tokens Generate token type definition only, no code. --raw-depend Invoke ocamldep and echo its raw output. --stdlib directory Specify where the standard library lies. --suggest-comp-flags Suggest compilation flags for ocaml{c,opt}. --suggest-link-flags-byte Suggest link flags for ocamlc. --suggest-link-flags-opt Suggest link flags for ocamlopt. -t, --table Use the table-based back-end. --timings Display internal timings. --trace Include tracing instructions in the generated code. --version Show version number and exit. -v Synonymous with --dump --explain. SEE ALSO
ocaml(1). AUTHOR
menhir was written by Francois Pottier and Yann Regis-Gianas. This manual page was written by Samuel Mimram <smimram@debian.org>, for the Debian project (but may be used by others). April 19, 2006 MENHIR(1)
All times are GMT -4. The time now is 10:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy