Sponsored Content
Full Discussion: parsing rows
Top Forums Shell Programming and Scripting parsing rows Post 302369243 by Scrutinizer on Saturday 7th of November 2009 04:20:05 AM
Old 11-07-2009
Code:
awk '{s=0;p=2;z=0
      for (i=2;i<=NF;i++) {
        if ($i !~ /[-.0-9]/) {s++; if (z==0) z=i}
        else if ($i>0) {$(p++)=i;$(p++)=$i}
      }
      printf "%s %s|%s  %s|%s  %s\n",$1,z-$2,$3,z-$4,$5,s}' infile

Code:
Barry 4|6  2|20  3
Brend 8|4  4|8  5
Harry 6|6  4|3  7
joe 2|9  1|3  3


Last edited by Scrutinizer; 11-07-2009 at 05:33 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Parsing String, Search then display rows

Get occurence of "open" considering duplicates(get the last open). Once you are pointing to the last open count 2 rows to get the correct data. Every begin and end statement, there is a "close" and "open". There can be many "close" and "open" within the begin and end statement but we are... (9 Replies)
Discussion started by: buddyme
9 Replies

2. Shell Programming and Scripting

Perl parsing compared to Ksh parsing

#! /usr/local/bin/perl -w $ip = "$ARGV"; $rw = "$ARGV"; $snmpg = "/usr/local/bin/snmpbulkget -v2c -Cn1 -Cn2 -Os -c $rw"; $snmpw = "/usr/local/bin/snmpwalk -Os -c $rw"; $syst=`$snmpg $ip system sysName sysObjectID`; sysDescr.0 = STRING: Cisco Internetwork Operating System Software... (1 Reply)
Discussion started by: popeye
1 Replies

3. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

4. Shell Programming and Scripting

Deleting specific rows in large files having rows greater than 100000

Hi Guys, I need help in modifying a large text file containing more than 1-2 lakh rows of data using unix commands. I am quite new to the unix language the text file contains data in a pipe delimited format sdfsdfs sdfsdfsd START_ROW sdfsd|sdfsdfsd|sdfsdfasdf|sdfsadf|sdfasdf... (9 Replies)
Discussion started by: manish2009
9 Replies

5. Shell Programming and Scripting

Remove 1st two rows and last 2 rows

Hi All, I need to remove 1st 2 line from head and last 2 line from last. I thought it would be possible by using the Head and tail command. But after i am using it is not possible by it. Example:Input file 1 2 3 4 5 Example: Output file 3 But my head and tail command are not... (12 Replies)
Discussion started by: kam786sim
12 Replies

6. Shell Programming and Scripting

Parsing the string into several rows

I'm getting the input row in this format it contains 2 alphabets followed by numbers between 1 and 7 and again 2 alphabets followed by numbers between 1 and 7. Now I need to parse this input into several output rows in this format 2 alphabets followed by each number occurrence suppose... (5 Replies)
Discussion started by: abhijith321
5 Replies

7. Shell Programming and Scripting

Split single rows to multiple rows ..

Hi pls help me out to short out this problem rm PAB113_011.out rm: PAB113_011.out: override protection 644 (yes/no)? n If i give y it remove the file. But i added the rm command as a part of ksh file and i tried to remove the file. Its not removing and the the file prompting as... (7 Replies)
Discussion started by: sri_aue
7 Replies

8. Shell Programming and Scripting

Parsing a CSV file and deleting all rows on condition

Hello list, I am working on a csv file which contains two fields per record which contain IP addresses. What I am trying to do is find records which have identical fields(IP addresses) which occur 4(four) times, and if they do, delete all records with that specific identical field(ip address). ... (4 Replies)
Discussion started by: landossa
4 Replies

9. UNIX for Dummies Questions & Answers

merging rows into new file based on rows and first column

I have 2 files, file01= 7 columns, row unknown (but few) file02= 7 columns, row unknown (but many) now I want to create an output with the first field that is shared in both of them and then subtract the results from the rest of the fields and print there e.g. file 01 James|0|50|25|10|50|30... (1 Reply)
Discussion started by: A-V
1 Replies

10. Shell Programming and Scripting

Moving or copying first rows and last rows into another file

Hi I would like to move the first 1000 rows of my file into an output file and then move the last 1000 rows into another output file. Any help would be great Thanks (6 Replies)
Discussion started by: kylle345
6 Replies
CTANH(3)						   BSD Library Functions Manual 						  CTANH(3)

NAME
ctanh -- complex hyperbolic tangent function SYNOPSIS
double complex ctanh(double complex z); long double complex ctanhl(long double complex z); float complex ctanhf(float complex z); DESCRIPTION
ctanh(z) computes the hyperbolic tangent of the complex floating-point number z. For all complex floating point numbers z, ctanh(conj(z)) = conj(ctanh(z)), ctanh(-z) = -ctanh(z). SPECIAL VALUES
The symmetries of ctanh() are used to abbreviate the specification of special values. ctanh(0 + 0i) returns 0 + 0i. ctanh(0 + inf i) returns NaN + NaN i, and raises the invalid flag. ctanh(0 + NaN i) returns NaN + NaN i. ctanh(x + inf i) returns NaN + NaN i, and raises the invalid flag, for finite nonzero x. ctanh(x + NaN i) returns NaN + NaN i, for finite nonzero x. ctanh(inf + 0i) returns 1 + 0i. ctanh(inf + yi) returns 1 +- 0i, for finite positive y, with the sign chosen to match the sign of sin(2y). ctanh(inf + inf i) returns 1 + 0i. ctanh(inf + NaN i) returns 1 + 0i. ctanh(NaN + 0i) returns NaN + 0i. ctanh(NaN + yi) returns NaN + NaN i, for nonzero numbers y. ctanh(NaN + NaN i) returns NaN + NaN i. NOTES
SEE ALSO
ctan(3) complex(3) STANDARDS
The ctanh() function conforms to ISO/IEC 9899:2011. 4th Berkeley Distribution December 11, 2006 4th Berkeley Distribution
All times are GMT -4. The time now is 08:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy