Sponsored Content
Top Forums Shell Programming and Scripting How to grep for a string on a FILENAME? Post 302999081 by RudiC on Tuesday 13th of June 2017 04:22:29 AM
Old 06-13-2017
With more than 700 posts in 6 years, you should at least have a faint idea on how to approach this "problemcito", which you certainly don't hesitate to share so we can discuss...?
This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Appending to filename a string of text grep finds

I am wanting to automate a process that includes the step of appending to a filename a string of text that's contained inside the file. I.e. if filename A.fileA contains a string of text that reads 1234 after the phrase ABC, I want the shell script file to rename the file 1234_FileChecked_A.fileA.... (3 Replies)
Discussion started by: HLee1981
3 Replies

2. Shell Programming and Scripting

grep string and output filename

Hello, I have over 200 files and some of them have the string like "John price $200". I would like to grep the string. Then output the filename which found the string. I have the following script, but it ONLY output the string echo Please input list file name: read listn for file in `cat... (3 Replies)
Discussion started by: happyv
3 Replies

3. Shell Programming and Scripting

using grep and print filename

Hi, I have a question on bash. Basically I would like to print a file name using bash. I am actually trying to grep a particular character in sequential files. I have alot files such that a.txt, b.txt,c.txt...etc. If I found a certain character, I would print that particular filename. I... (5 Replies)
Discussion started by: ahjiefreak
5 Replies

4. Shell Programming and Scripting

How to search (grep?) filename for a string and if it contains this then...

Hi i want to write a script that will search a filename e.g. test06abc.txt for a string and if it contains this string then set a variable equal to something: something like: var1=0 search <filename> for 06 if it contains 06 then var1=1 else var1=0 end if but in unix script :) (4 Replies)
Discussion started by: tuathan
4 Replies

5. Shell Programming and Scripting

grep -A 1 "string" filename

Dear all, can anyone pls provide equivalent of below code for solaris system.? grep -A 1 "string" filename the above command is working for Linux system. but i need same command for Solaris system thanks (8 Replies)
Discussion started by: steve2216
8 Replies

6. Linux

Find String in FileName and move the String to new File if not found

Hi all, I have a question.. Here is my requirement..I have 500 files in a path say /a/b/c I have some numbers in a file which are comma seperated...and I wanted to check if the numbers are present in the FileName in the path /a/b/c..if the number is there in the file that is fine..but if... (1 Reply)
Discussion started by: us_pokiri
1 Replies

7. Shell Programming and Scripting

grep exact string from files and write to filename when string present in file

I am attempting to grep an exact string from a series of files within a directory and append that output to the filename when it is present in the file. I've been after this all day with no luck. Thanks for your help in advance :wall:. (4 Replies)
Discussion started by: JC_1
4 Replies

8. Shell Programming and Scripting

Diff between grep .* file name and grep '.*' filename

Hi, Can anyone let me know what is difference between grep .* foo.c grep '.*' foo.c I am not able to understand what is exact difference. Thanks in advance (2 Replies)
Discussion started by: SasDutta
2 Replies

9. Shell Programming and Scripting

Regex for filename in grep

I want to print the filename keyword="XXTNL_AVSKRIV2ING" ftype="sql' I wan to search the keyword in all the sql files and the output shoul dbe filename:count grep -iwc "$keyword" *.$ftype | grep -v ":0$" But the output does not dispaly the filename which contains space as... (4 Replies)
Discussion started by: millan
4 Replies

10. UNIX for Dummies Questions & Answers

Usage of grep '^$1' filename

There is a file name list_filenames.dat, this has all the list of all files I need to encrypt, I did not understand what the following syntax is doing: grep -s "^$1" list_filenames.dat, when I manually run this command it just returns all the lines, what is the usage of this ? can someone... (4 Replies)
Discussion started by: okkadu
4 Replies
imua2(1)						      General Commands Manual							  imua2(1)

Name
       imua2 - Find USNO-A2.0 stars in FITS or IRAF image files

Synopsis
       imua2 [options] FITS or IRAF file(s)

Description
       Search  USNO-A2.0 Catalog within the area described by the world coordinate system in an image header.  This is a link to imcat rather than
       a separate executable.

Options
       -b [<RA> <Dec>]
	      Output in B1950, optional new image center in B1950 (FK4) RA and Dec

       -h     Print heading, else do not

       -j [<RA> <Dec>]
	      Output in J2000, optional new image center in J2000 (FK5) RA and Dec

       -m [<bright magnitude>] <faint magnitude>
	      Limiting catalog magnitude(s) (default none, bright -2 if only faint is given)

       -n <num>
	      Number of brightest stars to print

       -p <scale>
	      Initial plate scale in arcsec per pixel (default 0)

       -s     Sort by RA instead of flux

       -t     Tab table to standard output as well as file

       -u     USNO catalog single plate number to accept

       -v     Verbose listing of processing intermediate results

       -w     Write tab table output file imagename.cat -z Use AIPS classic projections instead of WCSLIB; use CD matrix or CDELT instead of poly-
	      nomial solution.

See Also
       imgsc(),imuac(),imusac(),scat()

Author
       Doug Mink, SAO (dmink@cfa.harvard.edu)

Options
       -b [<RA> <Dec>]
	      Output B1950 (FK4) coordinates (optional center)

       -u <plate>
	      Accept only stars from this plate (default all)

       -h     Print heading, else do not

       -j [<RA> <Dec>]
	      Output J2000 (FK5) coordinates (optional center)

       -m [<bright magnitude>] <faint magnitude>
	      Limiting catalog magnitude(s) (default none, bright -2 if only faint is given)

       -n <num>
	      Number of brightest stars to print

       -p <scale>
	      Plate scale in arcsec per pixel (default 0)

       -s     Sort by RA instead of flux

       -t     Tab table to standard output as well as file

       -u <plate>
	      Accept only stars from thsi plate (default all)

       -v     Verbose listing of processing intermediate results

       -w     Write tab table output file imagename.uac

See Also
       imcat(),imgsc(),imusa2(),scat()

Web Page
       http://tdc-www.harvard.edu/software/wcstools/imcat/imua2.html

Author
       Doug Mink, SAO (dmink@cfa.harvard.edu)

14 April 1998								WCS								  imua2(1)
All times are GMT -4. The time now is 09:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy