12-05-2005
yes you are right but why it gives 0 when I try to execute it through shell script. Let say the script is
dir1=/backup/surjya/mdbase
stgcnt=`grep -c $dir1 surya.txt `
echo $stgcnt
The value of stgcnt is 5.
Just modify the script like
dir1=/backup/surjya/mdbase
stgcnt=`grep -c \"$dir1"\>"\" surya.txt `
echo $stgcnt
The value of stgcnt is 0
I hope my question is clear.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi ALL,
I want to search one string “20 “ i.e 20 with space.
But my file where I am searching this “20 “ contain some data like
120 before image file truncated
220 Reports section succeeded
20 Transaction database .prd stopped
220 Reports section completed.
When I search for the... (5 Replies)
Discussion started by: Jeevan Salunke
5 Replies
2. UNIX for Dummies Questions & Answers
I have file named shortlist , and it contains this:
2233|charles harris |g.m. |sales |12/12/52| 90000
9876|bill johnson |director |production|03/12/50|130000
5678|robert dylan |d.g.m. |marketing |04/19/43| 85000
2365|john woodcock |director |personnel... (1 Reply)
Discussion started by: Cecko
1 Replies
3. Shell Programming and Scripting
Hi
I have to write command that find the files/dirs in the directory with access date equal to timestamp. ie or to be more precise I need to find files which are not equal to given timestamp
drwxr-xr-x 2 oracle oinstall 4096 May 31 2007 tmp
so need to have something like
find . *... (2 Replies)
Discussion started by: zam
2 Replies
4. Shell Programming and Scripting
Contents of my file is:
DI
DI
DIR
PHI
I want to extract only DI. I am using below command
grep -w DI <file>
but it is also extracting DI.
Can i use any other command to extract exact pattern where '[' does not have special meaning (4 Replies)
Discussion started by: nehashine
4 Replies
5. UNIX for Advanced & Expert Users
Hello Folks,
A wrapper takes an argument of file or directory name.
I want to allow paths that reside within the current directory only.
Can simply discard the paths like "/A" & "../" as they go outside the current by looking at the path beginning.
How to validate this one:
A/../../../b... (4 Replies)
Discussion started by: vibhor_agarwali
4 Replies
6. UNIX for Dummies Questions & Answers
Hi
I want know "How to find a file if we dont know exact location of file ?"
Thanks,
Tushar Joshi:) (9 Replies)
Discussion started by: tusharjoshi
9 Replies
7. Shell Programming and Scripting
QUESTION1:
How do you grep only an exact string. I am using Solaris10 and do not have any GNU products installed.
Contents of car.txt
CAR1_KEY0
CAR1_KEY1
CAR2_KEY0
CAR2_KEY1
CAR1_KEY10
CURRENT COMMAND LINE: WHERE VARIABLE CAR_NUMBER=1 AND KEY_NUMBER=1
grep... (1 Reply)
Discussion started by: thibodc
1 Replies
8. Shell Programming and Scripting
Im stumped on this one. Id like to echo into a .txt file all names for an xml feed in a huge folder. Can that be done?? Id need to echo <name>This name</name> in client.xml files.
$path="/mnt/windows/path"
echo 'recording names'
cd "$path"
for names in $path
than Im stuck on... (2 Replies)
Discussion started by: graphicsman
2 Replies
9. Shell Programming and Scripting
My Input :
Hi editor
this is the
exact
pattern
which we looking for
the
previous
patternmatch
My code:
awk '/pattern/ { print a } { a = $0 }'
Current output :
exact
previous (3 Replies)
Discussion started by: Roozo
3 Replies