It seems to me that you don't actually have .Z files in your directory, as indicated by the error you got. can you show a listing of what is currently in your directory?
Why not put
at the beginning of the script and see what is happening. May the the contents from the file is not being read into the variables properly.
It seems to me that you don't actually have .Z files in your directory, as indicated by the error you got. can you show a listing of what is currently in your directory?
Here Is the long listing :
total 4966860
-rw-r--r-- 1 oracle dba 573694919 Jan 21 2006 01.det_26dec_10jan06
-rw-r--r-- 1 oracle dba 106617087 Jan 30 2006 01a.det_11_25jan06.Z
-rw-r--r-- 1 oracle dba 115342143 Feb 14 2006 02.det_26jan_10feb06.Z
-rw-r--r-- 1 oracle dba 104965439 Feb 28 2006 02a.det_11_25feb06.Z
-rw-r--r-- 1 oracle dba 91796895 Mar 18 2006 03.det_26feb_10mar06.Z
-rw-r--r-- 1 oracle dba 136879104 Apr 4 2006 03a.det_11_31mar06.Z
-rw-r--r-- 1 oracle dba 96888889 Apr 18 2006 04.det_01_15apr06.Z
-rw-r--r-- 1 oracle dba 92467706 May 2 2006 04a.det_16_30apr06.Z
-rw-r--r-- 1 oracle dba 92596770 May 19 2006 05.det_01_15may06.Z
-rw-r--r-- 1 oracle dba 93294139 Jun 2 2006 05a.det_16_31may06.Z
-rw-r--r-- 1 oracle dba 84315109 Jun 19 2006 06.det_01_15june06.Z
-rw-r--r-- 1 oracle dba 82132177 Jul 3 2006 06a.det_16_30june06.Z
-rw-r--r-- 1 oracle dba 81434327 Jul 17 2006 07.det_01_15july06.Z
-rw-r--r-- 1 oracle dba 83665061 Aug 8 2006 07a.det_16_31july06.Z
-rw-r--r-- 1 oracle dba 74758692 Aug 19 2006 08.det_01_15aug06.Z
-rw-r--r-- 1 oracle dba 80815415 Sep 2 2006 08a.det_16_31aug06.Z
-rw-r--r-- 1 oracle dba 75974892 Sep 16 13:36 09.det_01_15sep06.Z
-rw-r--r-- 1 oracle dba 73488779 Oct 4 15:16 09a.det_16_30sep06.Z
-rw-r--r-- 1 oracle dba 69199285 Oct 17 11:42 10.det_01_15oct06.Z
-rw-r--r-- 1 oracle dba 70560621 Nov 3 09:01 10a.det_16_31oct06.Z
-rw-r--r-- 1 oracle dba 67741625 Nov 16 15:47 11.det_01_15nov06.Z
-rw-r--r-- 1 oracle dba 64394867 Dec 1 10:52 11a.det_16_30nov06.Z
-rw-r--r-- 1 oracle dba 62518866 Dec 16 12:30 12.det_01_15dec06.Z
-rw-r--r-- 1 oracle dba 64592095 Jan 1 10:15 12a.det_16_31dec06.Z
Why not put
at the beginning of the script and see what is happening. May the the contents from the file is not being read into the variables properly.
Here is the output after set -vx
cat 2006cases | awk '{print $1,$2}' | while read var1 var2
cat 2006cases | awk '{print $1,$2}' | while read var1 var2
> do
do
> zcat $var2*.Z | grep "^00011$var1" >> output
zcat $var2*.Z | grep "^00011$var1" >> output
> done
done
+ cat 2006cases
+ awk {print $1,$2}
+ read var1 var2
*.Z at 01
*.Z: No such file or directory
+ grep ^0001120093878
+ read var1 var2
*.Z at 01
*.Z: No such file or directory
+ grep ^0001120901190
+ read var1 var2
*.Z at 01
*.Z: No such file or directory
+ grep ^0001120004616
+ read var1 var2
*.Z at 01
*.Z: No such file or directory
+ grep ^0001120004648
+ read var1 var2
+ grep ^0001120005124
*.Z at 01
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120005157
*.Z at 01
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120005163
*.Z at 01
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120010938
*.Z at 01
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120026220
*.Z at 01
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120039617
*.Z at 01
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120055789
*.Z at 01
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120074845
*.Z at 01
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120563414
*.Z at 01
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120908313
*.Z at 01
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120908355
*.Z at 01
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120908355
*.Z at 01
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120908868
*.Z at 01
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120005124
*.Z at 02
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120005177
*.Z at 02
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120005225
*.Z at 02
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120005269
*.Z at 02
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120005277
*.Z at 02
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120073065
*.Z at 02
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120563414
*.Z at 02
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120567427
*.Z at 02
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120005528
*.Z at 03
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120005550
*.Z at 03
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120005558
*.Z at 03
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120005562
*.Z at 03
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120047199
*.Z at 03
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120049280
*.Z at 03
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120069616
*.Z at 03
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120090604
*.Z at 04
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120098202
*.Z at 08
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120065833
*.Z at 10
*.Z: No such file or directory
+ read var1 var2
+ grep ^0001120900330
*.Z at 11
*.Z: No such file or directory
+ read var1 var2
Actually, the variables are being read properly. But instead of zcat command being executed, you get
Quote:
*.Z at 01
Check if there are any special characters in your file (Try octal dump - od -c). I am not sure if that really shows up anything.
Actually, when you set the -vx option, you get the verbose output of whats actually being substituted. It looks like the zcat is command itself is not seen anywhere in the ouput. May be you could check for aliases for zcat or it could be some other issue not related to your code.
Team,
I want to change below parameter in all the files in a directory,
Check for HOSTNAME=`hostname`
Change to HOSTNAME=localhost
And I tried below but, its not working ☹
find /tmp -type f -exec sed 's/"HOSTNAME\=\`hostname\`"/"HOSTNAME\=localhost/g'"
Help me if I am missing... (6 Replies)
I have a file like this.
1 aaa bcd 1 56 xyz 1
2 ccc rrr 1 25 512 1
1 zaz eee 1 55 511 1
I want to change middle 1's ie after bcd,rrr,eee to 0 where as other 1's
should not change.
Can you please provide a solution . (5 Replies)
Hi experts :)
I need to replace special characters into a file , in the followiing way :
" --> ""
' --> ''
_--> \_
I tried with the sed command but I'm getting and error ksh: $: not found.
ksh: $: not found.
sed: Function s/\/\/ cannot be parsed.
Any idea ?
Thanks ,
KOLAS... (2 Replies)
I have the below 2 files:
1) Third field from file1.txt should be compared to the first field of lookup.txt.
2) If match found then third field, file1.txt should be substituted with the second field from lookup.txt.
3)Else just print the line from file1.txt.
File1.txt:... (4 Replies)
Hi gurus,
I need help with shell script. I have various INSERT queries which inserts data into database. I want to insert 3rd column data into newline for one particular table. I have very time long txt file everytime and it have various INSERT/UPDATE queries but i have to done with it only one... (8 Replies)
I have a large .gz file where i wish to replace the occurrence of a particular word with another word.. Can anyone help?I prefer a short script..
Can sed work with gz files? (5 Replies)
Hi,
I am new to this forum and my script skills are very weak.
I have this file (file 1) that contains 3 columns (tab delimited):
kyle start stop
john start stop
joe start stop
And I want to replace name (column 1) from another file. This other file has two columns, one is the... (4 Replies)
correct file names are:
*_0.txt
*_1.txt
incorrect file names are:
*_12.txt
*_0123.txt
*_04321.txt
all files that are incorrect need to replace the ending with *_1.txt
therefore need to create a loop to find the wrong files in a dir ->that dont end in _1.txt or _0.txt and then... (3 Replies)
well i have this file here:
<XML>
<pregate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<system_c>HPREGATE</system_c>
<trans_c>HSPG</trans_c>
<trans_dt>20060105161333</trans_dt>
<user_id_m></user_id_m>
<func_c>C</func_c>
</pregate>
</XML>
i want to... (2 Replies)