10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to create a cronjob that will run on startup that will look at a list.txt file to see if there is a later version of a database using database.txt as the source. The matching lines are written to output.
$1 in database.txt will be in list.txt as a partial match. $2 of database.txt... (2 Replies)
Discussion started by: cmccabe
2 Replies
2. Shell Programming and Scripting
Hi All,
I am breaking my head in trying to get a command that will exactly match my given string. I have searched net and found few of the options -
grep -F $string file
grep -x $string file
grep "^${string}$" file
awk '/"${string}"/ {print $0}' file
strangely nothing seems to... (3 Replies)
Discussion started by: dips_ag
3 Replies
3. Shell Programming and Scripting
file
11 2
12 6
13 7
114 6
011 7
if I'm searching for 11, output needed is
output:
11 2
011 7
Code: awk '$1 ~ /^11$/' file
I used the above to match exact, but it avoiding "011 7" line too, how to resolve this? (6 Replies)
Discussion started by: Roozo
6 Replies
4. Shell Programming and Scripting
Hi friends,
i am using the following grep command for exact word match:
>echo "sachin#tendulkar" | grep -iw "sachin"
output: sachin#tendulkar
as we can see in the above example that its throwinng the exact match(which is not the case as the keyword is sachin and string is... (6 Replies)
Discussion started by: neelmani
6 Replies
5. UNIX for Dummies Questions & Answers
I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL.
I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies
6. Shell Programming and Scripting
Hi,
I have a file like follows
.
.
.
White.Jack.is.going.home
Black.Jack.is.going.home
Red.Jack.is.going.home
Jack.is.going.home
.
.
.
when I make:
cat <file> | grep -w "Jack.is.going.home"
it gives:
White.Jack.is.going.home
Black.Jack.is.going.home
Red.Jack.is.going.home... (4 Replies)
Discussion started by: salih81
4 Replies
7. Shell Programming and Scripting
I am trying to match a pattern exactly in a shell script. I have tried two methods
awk '/\<mpath${CURR_MP}\>/{print $1 $2}' multipath
perl -ne '/\bmpath${CURR_MP}\b/ and print' /var/tmp/multipath
Both these methods require that I use the escape character. I am guessing that is why... (8 Replies)
Discussion started by: bash_in_my_head
8 Replies
8. Shell Programming and Scripting
Hi All,
Str="online maintenance"
if then perform some action
I know the above comparison is wrong ..... Actually I am very new to this solaris..
I want to check for online in a variable and perform some action based on that How can I do it? (6 Replies)
Discussion started by: vijaysachin
6 Replies
9. Shell Programming and Scripting
How to emulate grep -o option in perl.
I mean to print not all line, only the exact match.
echo "2A2 BB" | perl -ne 'print if /2A2/'
2A2 BB
I want to print only 2A2. (2 Replies)
Discussion started by: mirusnet
2 Replies
10. UNIX for Dummies Questions & Answers
Hi all,
Is anyone able to help with the following query?
I have an input file with several lines of words, e.g.
"hellolaylahello"
"hellohellohellolayla"
I want to search for the exact string "hello" in each line and display:
2 "hellolaylahello"
3 "hellohellohellolayla"
I... (11 Replies)
Discussion started by: dr_sabz
11 Replies