Sponsored Content
Top Forums Shell Programming and Scripting find expression with awk in only one column, and if it fits, print whole column Post 302390057 by Scrutinizer on Tuesday 26th of January 2010 07:56:50 PM
Old 01-26-2010
Or:
Code:
sed -n "s/^$NUMBER *//p" infile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question about sort specific column and print other column at the same time !

Hi, This is my input file: ali 5 usa abc abu 4 uk bca alan 6 brazil bac pinky 10 utah sdc My desired output: pinky 10 utah sdc alan 6 brazil bac ali 5 usa abc abu 4 uk bca Based on the column two, I want to do the descending order and print out other related column at the... (3 Replies)
Discussion started by: patrick87
3 Replies

2. Shell Programming and Scripting

Need to different value print in same column by awk

Hi , i am trying to prepare a text file by awk . My code is like below echo "$a $b $c $d $e $f $g $h "|nawk '{for(i=1;i<=5;i++){printf("%s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t\n", $1 , $2 ,$3 ,$4 ,$5 ,$6 ,$7 ,$8)}}' >> tempfile.txt Now my req is $d will print as per user req . if user inputs... (2 Replies)
Discussion started by: Pratik4891
2 Replies

3. Shell Programming and Scripting

comparing column of two different files and print the column from in order of 2nd file

Hi friends, My file is like: Second file is : I need to print the rows present in file one, but in order present in second file....I used while read gh;do awk ' $1=="' $gh'" {print >> FILENAME"output"} ' cat listoffirstfile done < secondfile but the output I am... (14 Replies)
Discussion started by: CAch
14 Replies

4. Shell Programming and Scripting

awk command to print only selected rows in a particular column specified by column name

Dear All, I have a data file input.csv like below. (Only five column shown here for example.) Data1,StepNo,Data2,Data3,Data4 2,1,3,4,5 3,1,5,6,7 3,2,4,5,6 5,3,5,5,6 From this I want the below output Data1,StepNo,Data2,Data3,Data4 2,1,3,4,5 3,1,5,6,7 where the second column... (4 Replies)
Discussion started by: ks_reddy
4 Replies

5. UNIX for Dummies Questions & Answers

awk to print first row with forth column and last row with fifth column in each file

file with this content awk 'NR==1 {print $4} && NR==2 {print $5}' file The error is shown with syntax error; what can be done (4 Replies)
Discussion started by: cdfd123
4 Replies

6. Shell Programming and Scripting

Print every 5 4th column values as separate row with different first column

Hi, I have the following file, chr1 100 200 20 chr1 201 300 22 chr1 220 345 23 chr1 230 456 33.5 chr1 243 567 90 chr1 345 600 20 chr1 430 619 21.78 chr1 870 910 112.3 chr1 914 920 12 chr1 930 999 13 My output would be peak1 20 22 23 33.5 90 peak2 20 21.78 112.3 12 13 Here the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

7. 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

8. Shell Programming and Scripting

Help with compare two column and print out column with smallest number

Input file : 5 20 500 2 20 41 41 0 23 1 Desired output : 5 2 20 0 1 By comparing column 1 and 2 in each line, I hope can print out the column with smallest number. I did try the following code, but it don't look good :( (2 Replies)
Discussion started by: perl_beginner
2 Replies

9. Shell Programming and Scripting

awk to find maximum and minimum from column and store in other column

Need your support for below. Please help to get required output If column 5 is INV then only consider column1 and take out duplicates/identical rows/values from column1 and then put minimum value of column6 in column7 and put maximum value in column 8 and then need to do subtract values of... (7 Replies)
Discussion started by: as7951
7 Replies

10. Shell Programming and Scripting

Need awk or Shell script to compare Column-1 of two different CSV files and print if column-1 matche

Example: I have files in below format file 1: zxc,133,joe@example.com cst,222,xyz@example1.com File 2 Contains: hxd hcd jws zxc cst File 1 has 50000 lines and file 2 has around 30000 lines : Expected Output has to be : hxd hcd jws (5 Replies)
Discussion started by: TestPractice
5 Replies
funcombine(7)							SAORD Documentation						     funcombine(7)

NAME
FunCombine - Combining Region and Table Filters SYNOPSIS
This document discusses the conventions for combining region and table filters, especially with regards to the comma operator. DESCRIPTION
Comma Conventions Filter specifications consist of a series of boolean expressions, separated by commas. These expressions can be table filters, spatial region filters, or combinations thereof. Unfortunately, common usage requires that the comma operator must act differently in different situations. Therefore, while its use is intuitive in most cases, commas can be a source of confusion. According to long-standing usage in IRAF, when a comma separates two table filters, it takes on the meaning of a boolean and. Thus: foo.fits[pha==1,pi==2] is equivalent to: foo.fits[pha==1 && pi==2] When a comma separates two spatial region filters, however, it has traditionally taken on the meaning of a boolean or. Thus: foo.fits[circle(10,10,3),ellipse(20,20,8,5)] is equivalent to: foo.fits[circle(10,10,3) || ellipse(20,20,8,5)] (except that in the former case, each region is given a unique id in programs such as funcnts). Region and table filters can be combined: foo.fits[circle(10,10,3),pi=1:5] or even: foo.fits[pha==1&&circle(10,10,3),pi==2&&ellipse(20,20,8,5)] In these cases, it is not obvious whether the command should utilize an or or and operator. We therefore arbitrarily chose to implement the following rule: o if both expressions contain a region, the operator used is or. o if one (or both) expression(s) does not contain a region, the operator used is and. This rule handles the cases of pure regions and pure column filters properly. It unambiguously assigns the boolean and to all mixed cases. Thus: foo.fits[circle(10,10,3),pi=1:5] and foo.fits[pi=1:5,circle(10,10,3)] both are equivalent to: foo.fits[circle(10,10,3) && pi=1:5] [NB: This arbitrary rule replaces the previous arbitrary rule (pre-funtools 1.2.3) which stated: o if the 2nd expression contains a region, the operator used is or. o if the 2nd expression does not contain a region, the operator used is and. In that scenario, the or operator was implied by: pha==4,circle 5 5 1 while the and operator was implied by circle 5 5 1,pha==4 Experience showed that this non-commutative treatment of the comma operator was confusing and led to unexpected results.] The comma rule must be considered provisional: comments and complaints are welcome to help clarify the matter. Better still, we recommend that the comma operator be avoided in such cases in favor of an explicit boolean operator. SEE ALSO
See funtools(7) for a list of Funtools help pages version 1.4.2 January 2, 2008 funcombine(7)
All times are GMT -4. The time now is 01:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy