06-27-2007
Check whether the pattern is present or not?
I want to determine whether a specific pattern is present within a line or not
e.g.
The whole line is in a varaible called VALUE
VALUE="(ABC, DEF, NMF, ABC, CLF, PAR, FHG, AGQSAs, sada, sa, ABC)"
i want to set a flag to 1 if i find the presence of ABC in the above variable.
Please tell me how to do it in a Shell Script?
Thanks in advance
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
following situation...
- bourne shell script
- sb. should entry a path and the script should look if the path exists, when not it should restart the Input
...
echo "path\c"
read Inp
if ; then
echo " path doesn't exist, try again... "
(how to go back to the Inp?????)
else
echo "... (3 Replies)
Discussion started by: svennie
3 Replies
2. Shell Programming and Scripting
Hi ,
I am trying to check wether the variable is present in the array. please see the below code .when ever i do this its taking only the first value of the array . please advise.
###Code Snnipet ###
#!/bin/ksh
set -xv
if ]; then
echo " you have Specified the ORG ID - $1 "
... (1 Reply)
Discussion started by: padhu.47
1 Replies
3. Shell Programming and Scripting
I'm trying to check whether 3 files are existing and send 3 files as attachements.
If only two are there then send those two files as attachments.
if ; then
elif ; then
I tired the above given syntax and then it is giving me an error
line 11: '
I tried with -a instead of && and... (3 Replies)
Discussion started by: Celvin VK
3 Replies
4. Shell Programming and Scripting
Hi All,
I have txt file which has list of files. I have to check whether these files exist or not.
Thanks
supriya (6 Replies)
Discussion started by: supriyabv
6 Replies
5. Shell Programming and Scripting
Hi All,
I have a file with following list.
example 1
========
cat 1.txt
--------
0000cab4752c
0000dab47c2c
...
...
...
Also i have another file 2.txt in which the data is in this format as shown:
cat 2.txt
---------... (6 Replies)
Discussion started by: imas
6 Replies
6. Shell Programming and Scripting
Hello,
I have a comma delimited file such as:
cat /statistics/support/input.txt
ID,Serial,quantitity,atribute1,atribute2
1,89569698,5,800,9900,
1,35568658,8,1200,5550
1,89569698,8,320,5500
1,68753584,85,450,200
ID should always have 1 digit, Serial 8 digits, and the others may... (2 Replies)
Discussion started by: alex2005
2 Replies
7. Shell Programming and Scripting
here is what i want to achieve.. i have a file with below contents
cat fileName
blah blah blah
.
.DROP this
REJECT that
.
--sport 7800 -j REJECT --reject-with icmp-port-unreachable
--dport 7800 -j REJECT --reject-with icmp-port-unreachable
.
.
.
more blah blah blah
--dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies
8. Shell Programming and Scripting
Hi,
I have a file with following pattern. We are looking to filter out only specific content from this file.
sample
BLAdmins Server.*
LinuxAdmins Server.*
Policy Name: Recommended Default ACL Policy
Everyone ACLPushJob.Read
Everyone ACLTemplate.Read
Everyone ... (9 Replies)
Discussion started by: Litu19
9 Replies
9. UNIX for Beginners Questions & Answers
Hi All-I am new to Unix , I need to write a script. Can someone help me with a requirement where I have list of files in a directory, I want to Merge the files if a pattern of string matches in filenames?
AAAL_555A_ORANGE1_F190404.TXT
AAAL_555A_ORANGE2_F190404.TXT
AAAL_555A_ORANGE3_F190404.TXT... (6 Replies)
Discussion started by: Shankar455
6 Replies