Sponsored Content
Top Forums Shell Programming and Scripting awk print values between consecutive lines Post 302878322 by alex2005 on Thursday 5th of December 2013 01:49:02 PM
Old 12-05-2013
Thank you, worked very well.

The output with 4 lines was when
Code:
ABC     12316   62.12   12042013   165143

was missing. I tested your script and works well even if a value is missing from group.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need help cutting consecutive lines with sed or awk

HI All, I want to cut 5 lines after a pattern using sed or awk. can any one tell me how to do it ? (2 Replies)
Discussion started by: raghin
2 Replies

2. Shell Programming and Scripting

AWK: combining consecutive values in a field

Hi, Here is my sample input X 2 AAA Y 3 BBB Y 2 CCC Z 4 DDD In field 1, if the value of one line is same as that of next line, I want to concatenate the corresponding value of the second line in the third field with the value of the third field of first line. And I dont need the third... (2 Replies)
Discussion started by: polsum
2 Replies

3. UNIX for Dummies Questions & Answers

Only print lines with 3 numeric values

Hey guys & gals, I am hoping for some advice on a sed or awk command that will allow to only print lines from a file that contain 3 numeric values. From previous searches here I saw that ygemici used the sed command to remove lines containing more than 3 numeric values ; however how... (3 Replies)
Discussion started by: TAPE
3 Replies

4. Shell Programming and Scripting

Print lines containing same values in a group

Hi, I have a table like this: Name A1 A2 A3 B1 B2 B3 111 abc abc abc cbc cbc cbc 222 acv acv n_n bbc bbc bbc 333 bvv bvv bvv cBx ccx ccx 444 ttk ttk ttk kke kke kke 555 mcr mcr mcr mcr mcr mcr The 1st column is just names... (3 Replies)
Discussion started by: polsum
3 Replies

5. Shell Programming and Scripting

How to compare the values of a column in awk in a same file and consecutive lines..

I would like to compare the values of 2nd column of consecutive lines of same file in such a way so that if the difference between first value and second value is more than 100 it should print complete line else ignore line. Input File ========== PDB 2500 RTDB 123 RTDB-EAGLE 122 VSCCP 2565... (4 Replies)
Discussion started by: manuswami
4 Replies

6. Shell Programming and Scripting

awk Print New Column For Every Two Lines and Match On Multiple Column Values to print another column

Hi, My input files is like this axis1 0 1 10 axis2 0 1 5 axis1 1 2 -4 axis2 2 3 -3 axis1 3 4 5 axis2 3 4 -1 axis1 4 5 -6 axis2 4 5 1 Now, these are my following tasks 1. Print a first column for every two rows that has the same value followed by a string. 2. Match on the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

7. Shell Programming and Scripting

Print values within groups of lines with awk

Hello to all, I'm trying to print the value corresponding to the words A, B, C, D, E. These words could appear sometimes and sometimes not inside each group of lines. Each group of lines begins with "ZYX". My issue with current code is that should print values for 3 groups and only is... (6 Replies)
Discussion started by: Ophiuchus
6 Replies

8. Shell Programming and Scripting

How to print lines that have values in certain columns ?

Hi, everyone I have a dataset like this: A B C D A C C D E F G H F D K Y X A K K C Gsome of columns have no values in each line. I want to print all lines that have 1/2/3/4 values, export separately to four files. What I expected is like this: file1 Y file 2 A C X Afile 3... (3 Replies)
Discussion started by: nengcheng
3 Replies

9. UNIX for Beginners Questions & Answers

awk - If field value of consecutive records are the identical print portion of lines

I have some data that looks like this: PXD= ZW< 1,6 QR> QRJ== 1,2(5) QR> QRJ== 4,1(2) QR> QRJ== 4,2 QRB= QRB 4,2 QWM QWM 6,2 R<C ZW< 11,2 R<H= R<J= 6,1 R>H XZJ= 1,2(2) R>H XZJ= 2,6(2) R>H XZJ= 4,1(2) R>H XZJ= 6,2 RDP RDP 1,2 What I would like to do is if fields $1 and $2 are... (5 Replies)
Discussion started by: jvoot
5 Replies

10. UNIX for Beginners Questions & Answers

find pattern matches in consecutive lines in certain fields-awk

I have a text file with many thousands of lines, a small sample of which looks like this: InputFile:PS002,003 D -1 5 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 6 -1 -1 -1 -1 0 509 0 PS002,003 PSQ 0 1 7 18 1 0 -1 1 1 3 -1 -1 ... (5 Replies)
Discussion started by: jvoot
5 Replies
TABS(1) 						    BSD General Commands Manual 						   TABS(1)

NAME
tabs -- set terminal tabs SYNOPSIS
tabs [-n|-a|-a2|-c|-c2|-c3|-f|-p|-s|-u] [+m[n]] [-T type] tabs [-T type] [+[n]] n1[,n2,...] DESCRIPTION
The tabs utility displays a series of characters that first clears the hardware terminal tab settings and then initializes the tab stops at the specified positions and optionally adjusts the margin. The phrase "tab-stop position N" means that, from the start of a line of output, tabbing to position N shall cause the next character output to be in the (N+1)th column on that line. The following options are supported: -n Specifies repetitive tab stops separated by a uniform number of columns, n, where n is a single digit decimal number. The default usage of tabs with no arguments is equivalent to tabs -8. When -0 is used, the tab stops are cleared and no new ones set. -a Assembler, applicable to some mainframes. Equivalent to tabs 1,10,16,36,72 . -a2 Assembler, applicable to some mainframes. Equivalent to tabs 1,10,16,40,72 -c COBOL, normal format. Equivalent to tabs 1,8,12,16,20,55 -c2 COBOL, compact format (columns 1 to 6 omitted). Equivalent to tabs 1,6,10,14,49 -c3 COBOL, compact format (columns 1 to 6 omitted), with more tabs than -c2. Equivalent to tabs 1,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,67 -f FORTRAN. Equivalent to tabs 1,7,11,15,19,23 -p PL/1. Equivalent to tabs 1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61 -s SNOBOL. Equivalent to tabs 1,10,55 -T type Indicates the type of terminal. -u Assembler, applicable to some mainframes. Equivalent to tabs 1,12,20,44 EXIT STATUS
The tabs utility exits 0 on success, and >0 if an error occurs. ENVIRONMENT
The COLUMNS and TERM environment variables affect the execution of tabs as described in environ(7). The -T option overrides TERM. If neither TERM nor the -T option are present, tabs will fail. SEE ALSO
expand(1), stty(1), tput(1), unexpand(1), termcap(5) STANDARDS
The tabs utility conforms to IEEE Std 1003.1 (``POSIX.1''). HISTORY
A tabs utility first appeared in PWB UNIX. This implementation was introduced in NetBSD 6.0. AUTHORS
Roy Marples <roy@NetBSD.org> BUGS
The current termcap(5) database does not define the set left soft margin 'ML' capability for any terminals. BSD
December 9, 2008 BSD
All times are GMT -4. The time now is 02:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy