I call my bash shell script "test.sh" and pass "admin_usr.txt" as an argument like below.
Inside the "test.sh" i wish to check if the filename passed "admin_usr.txt" i.e "$1" contains the string "admin" or not ... which in this case it does.
Note: I do not wish to search contents of the file but only the filename which is being passed as argument.-.
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)