10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I call my bash shell script "test.sh" and pass "admin_usr.txt" as an argument like below.
./test.sh admin_usr.txt
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... (5 Replies)
Discussion started by: mohtashims
5 Replies
2. UNIX for Dummies Questions & Answers
This should recursively walk through all dirictories and
search for a specified string in all present files, if found
output manicured content (eg some regex) with CAT into
a specified directory (eg /tmp/)
one by one, keeping the original names
This is what I have so far, which seems to... (1 Reply)
Discussion started by: lowmaster
1 Replies
3. Shell Programming and Scripting
Hi all,
I have a file: /var/log/lct/buildinformation
I am trying to grep for string: MANUFACTURER : VMware, Inc.
If it contains the string I want to output the results of:df -h |grep '/usr|/var' |awk '{print $6 " "$5}'
If it does not have the above string to send a no vm found... (6 Replies)
Discussion started by: gartie
6 Replies
4. Shell Programming and Scripting
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
5. Shell Programming and Scripting
How can I grep exactly a string that has .,/ characters using grep?
Example: I want to grep ONLY string1 and not string1.more or string1.more.evenmore
#lsauth ALL|grep 'string1'
All output:
string1 <--- This is the only I want.
string1.more
string1.evenmore.
more.string1... (4 Replies)
Discussion started by: iga3725
4 Replies
6. Shell Programming and Scripting
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
7. Shell Programming and Scripting
Hi all
i'm new in KSH,
i want to write a script to grep a logs files and redirecting the result into a relative subdirectory/file.txt that must be created near to each log file
my begin script is :
find ./logs -type f -name "*.log" -exec grep error {} \;
how i can perform that modest... (10 Replies)
Discussion started by: rambler
10 Replies
8. UNIX for Dummies Questions & Answers
Hi all,
I am trying to zgrep / grep list of files so that it displays only the matching filename:line number and does not display the whole line, like:
(echo "1.txt";echo "2.txt") | xargs zgrep -no STRING
If I use -o option, it displays the matching STRING and if not used, displays the... (3 Replies)
Discussion started by: vvaidyan
3 Replies
9. Shell Programming and Scripting
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
10. Shell Programming and Scripting
I have the following line in a script that searches files in several directories and shows the search results on the screen.
ls "$path" | xargs cat | tr -s " " | fgrep -i "$search_arg"
But, because I'm also using CAT and TR, the output from the search does not display the name of the file... (6 Replies)
Discussion started by: netguy
6 Replies