If a file is compressed, how can i uncompress on the fly using pipes(handling this in the shell script depending on the command line arguments passed to the script)
ex: ex_pr.sh -d disable -f ex_pr_1212.log.Z
Last edited by dreams5617; 12-07-2004 at 09:15 AM..
This is all very dependent on how your shell script handles this. Seeing as you are supplying the compressed file as an argument to option "-f", then I would assume that the actual file opening and processing is handled internally within the script.
If, however, the script read from stdin, you could do
zcat somefile.Z | myscript
You can't do
myscript -f `zcat somefile.Z`
because that would expand the whole file and supply each word as an argument. Definitely not what you want!
You could add a handler to your shell script that looks at the supplied file's extension, and invokes zcat to read the file if it has a ".Z" extension.
EDIT: Please give your threads a more descriptive title than just "Ques". A descriptive, useful title will help people who have the appropriate knowledge find your post and help you out. Something like "Compressed file as a script argument" or similar would have been better for this post.
If i pass ex_p1.log.Z as the argument at the command line
i want inside the script ex_p1.log(as the file name), i.e checking if the file extension is .Z(how ?), if it has .Z i want to uncompress so
ex_p1.log.Z is replaced as ex_p1.log (using pipes on fly -how ?)
hello guys!! need 1 favour from u all..
Can u jst tell me the answers for these ques??
1. ls - l _____ : command to return all files that end with single digit and those with TXT extension
2. ls -l report* _______ : command to return all files that start with the word RPT except those with LOG... (1 Reply)
hy guys
I got a ques
I cant acess root, i tried to fsck it, but gets errors to read file systems. What steps do you take to recover the host before you see if there is any data corruption on the root drive?
Regards
Charneet (1 Reply)
Hello...
Im trying to use "- " as field separator...
I used awk -F"- " '{print $3}' input_file ... but it's not working, it assumes that the field separator is "-" and not "- " ...
Any ideas ?? :(
Thanks (6 Replies)
i have couple of my assignment questions
What command results in adding today's date and time to the file yesterday.txt
What command results in creation of a new file named yesterday.txt that contains yesterday's date but no time (3 Replies)