Sponsored Content
Top Forums UNIX for Advanced & Expert Users Recursively search the string from a column in no. of files Post 302810607 by millan on Wednesday 22nd of May 2013 07:30:06 AM
Old 05-22-2013
Thank you Rudic..
I tried your code but it is giving error as below.
Code:
$ awk 'FNR == NR {X[$5]; next}
     FNR == 1  {found = 0}
     !found    {for (i in X) if (match ($0, i) {print FILENAME; found = 1; break }
    ' FS="," keyword.csv FS=" " *.pl
> > > awk: syntax error near line 3

awk: bailing out near line 3


I am using SunOS.
And also just now i modified the question..that i want the filename as well as 10th and 5th coloumn in the output..

Please let know how to do it.

Last edited by jim mcnamara; 05-22-2013 at 09:30 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String search and return value from column

Dear All I had below mention file as my input file. 87980457 Jan 12 2008 2:00AM 1 60 BSC1 81164713 Jan 12 2008 3:00AM 1 60 BSC2 78084521 Jan 12 2008 4:00AM 1 60 BSC3 68385193... (3 Replies)
Discussion started by: jaydeep_sadaria
3 Replies

2. Shell Programming and Scripting

Search for string dublicates in column

Hi I have a file with one column. There are a few replicas in this column, that is some lines look exactly the same. I want to know the ones that occur twice. Inputfile.xml "AAH.dbEUR" "ECT.dbEUR" "AEGN.dbEUR" "AAH.dbEUR" "AKZO.dbEUR" ... Here I would like to be informed that... (7 Replies)
Discussion started by: lulle
7 Replies

3. Shell Programming and Scripting

find and replace a search string recursively in files

Hi , I have a directory structure as dir and subdirectories and files under it and so on.now I need to find the files which contain the search string under every dir and subdir and replace . my search string is like searchstring=/a/b string to be replaced=/a/c/b please help. ... (7 Replies)
Discussion started by: mohanpadamata
7 Replies

4. Shell Programming and Scripting

Search in a column by a string

Hi All, My file looks like : hsdhj dsajhf jshdfajkh jksdhfj jkdhsfj shfjhd shdf hdsfjkh jsdfhj hdshf sdjh dhs foot dsjhfj jdshf dasfh jdsh dsjfh jdfshj david Now, I want to search entire column by a string... (10 Replies)
Discussion started by: naw_deepak
10 Replies

5. Linux

Search files recursively

grep pattern filename To search for the pattern in all files in the current directory and the sub-directories recursively, what needs to be substituted in filename? (1 Reply)
Discussion started by: ravisingh
1 Replies

6. Shell Programming and Scripting

Search/Replace in multiple files recursively

Hi there, I am using AIX and trying to search and replace a string with another string in multiple files in different directories. I wanted to search replace in steps so I don't change all of the instance anywhere in the server at once, minimizing impact. STEP 1: -------- I first searched... (5 Replies)
Discussion started by: zaino22
5 Replies

7. Shell Programming and Scripting

How can I use find command to search string/pattern in a file recursively?

Hi, How can I use find command to search string/pattern in a file recursively? What I tried: find . -type f -exec cat {} | grep "make" \; Output: grep: find: ;: No such file or directory missing argument to `-exec' And this: find . -type f -exec cat {} \; -exec grep "make" {} \;... (12 Replies)
Discussion started by: cola
12 Replies

8. Shell Programming and Scripting

Search string in multiple files and display column wise

I have 3 files. Each of those files have the same number of records, however certain records have different values. I would like to grep the field in ALL 3 files and display the output with only the differences in column wise and if possible line number File1 Name = Joe Age = 33... (3 Replies)
Discussion started by: sidnow
3 Replies

9. Shell Programming and Scripting

Search for string in column using variable: awk

I'm interested to match column pattern through awk using an external variable for data: -9 1:751343:T:A -9 0 T A 0.726 -5.408837e-03 9.576603e-03 7.967536e-01 5.722312e-01 -9 1:751756:T:C -9 0 T C 0.727 -5.360458e-03 9.579447e-03 7.966977e-01 5.757858e-01... (7 Replies)
Discussion started by: genome
7 Replies

10. UNIX for Beginners Questions & Answers

Search strings from a file in files in a directory recursively; then print the string with a status

Hi All, I hope somebody would be able to help me. I would need to search a string coming from a file, example file.txt: dog cat goat horse fish For every string, I would need to know if there are any files inside a directory(recursively) that contains the string regardless of case.... (9 Replies)
Discussion started by: kokoro
9 Replies
fitsort(1)						      General Commands Manual							fitsort(1)

NAME
fitsort - sort FITS header information from a list of files SYNOPSIS
dfits <FITS files...> | fitsort <FITS keywords...> DESCRIPTION
fitsort extract keyword values from a set of FITS headers and outputs it in an ASCII table format, which is compatible with most data pro- cessing software packages. It shall only be used in combination with the dfits utility. The ASCII output is shown in columns. Columns are aligned with blank characters and also separated by tabulations. Blank alignment allows human readers to visualize the output in a pretty format, tabulations are there for spreadsheet compatibility. If you want to load out fit- sort output into any spreadsheet, specify that fields shall be separated by tabulations and entries separated by linefeeds. Examples : dfits *.fits | fitsort BITPIX NAXIS NAXIS1 NAXIS2 The output would look like: FILE BITPIX NAXIS NAXIS1 NAXIS2 file0001.fits 16 2 128 128 file0002.fits 32 2 512 512 ... ESO specific features in the FITS header are also supported. To get values for 'HIERARCH ESO' keywords, just give the complete names within double quotes. e.g. dfits *.fits | fitsort "HIERARCH ESO INS LENS" Another way of giving HIERARCH ESO keywords is to use the short FITS notation, the above example can be given as: dfits *.fits | fitsort INS.LENS Example: to retrieve the DPR keywords from an ESO FITS header, you would use: dfits *.fits | fitsort To be completed... DPR.CATG DPR.TYPE DPR.TECH This second way of requesting HIERARCH ESO keywords is not only shorter to type, it also avoids typing quotes or double-quotes on the com- mand-line, making it easier to script with fitsort. Notice that the keywords you give on the command-line are case-insensitive. The above line is equivalent to: dfits *.fits | fitsort dpr.catg dpr.type dpr.tech OPTIONS
-d Do not print out the first output line. This option is useful to get only the query results, without the top line (giving all column names). This makes it easy to script fitsort from programs like awk or perl. FILES
Input files to dfits shall all comply with FITS format. fitsort also supports HIERARCH ESO FITS format. SEE ALSO
dfits (1) 25 Jun 2001 fitsort(1)
All times are GMT -4. The time now is 01:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy