10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i had the below script
x=`cat input.txt |wc -1`
awk 'NR>1 && NR<'$x' ' input.txt > output.txt
by using above script i am able to remove the head and tail part from the input file and able to append the output to the output.txt but if i run it for second time the output is... (2 Replies)
Discussion started by: hemanthsaikumar
2. Shell Programming and Scripting
I am attempting to rename files within a zipped archive with the beginning of the name of the zip file. For example unzip AAA_000.zip and rename file1.csv, file2.txt to AAA_file1.csv, AAA_file2.txt.
I am able to do this for a zip file with one file inside, but not for multiple files. This is... (2 Replies)
Discussion started by: lcp
3. UNIX for Dummies Questions & Answers
Hi ladies and gentleman.. I have two text file with me. I need to replace one of the file content to another file if one both files have a matching pattern.
XXXX,ABCD... (25 Replies)
Discussion started by: bananamen
4. Shell Programming and Scripting
Plese help I need a urgent requirement.
requirement : using shell script I need to archive the log file and nil and the content of (test.log) file to 0 kb
and then in the archive folder log files are name to test.tar
test.log ... (1 Reply)
Discussion started by: johney1981
5. Shell Programming and Scripting
I need to be able to take the results from ls -l command and modify the output as follows:
I will run
ls -l *.mak
My results will be
I then need to take those results and create a file that has the following info:
... (3 Replies)
Discussion started by: jclanc8
6. Shell Programming and Scripting
i have texts down.txt and down-new.txt and i want to check;
- if down-new.txt is NOT empty, then write date and its content to /home/gc_sw/down.txt
and after checking down-new.txt is NOT empty, down.txt should... (10 Replies)
Discussion started by: gc_sw
7. UNIX for Dummies Questions & Answers
I've setup a cron job that greps a file every five minutes and then writes (appends) the grep output/result to another file:
grep "monkey" zoo.log | tail -1 >> cron-zoo-log
Is there any way I can add the date and time (timestamp) to the cron-zoo-log file for each time a new line was added?
... (12 Replies)
Discussion started by: Sepia
8. Shell Programming and Scripting
how to make bash script to create foo.txt file and add current date into file content and that file always append.
example: today the script run and add today date into content foo.txt
and tomorrow the script will run and add tomorrow date in content foo.txt without remove today... (3 Replies)
Discussion started by: chenboly
9. UNIX for Dummies Questions & Answers
i need a script which will create a archive of the files older than 10 days........ (2 Replies)
Discussion started by: jayaramanit
10. UNIX for Dummies Questions & Answers
After checking all the UNIX threads, I am able to come up with a solution so far. I am working on a shell script where it moves the files to a certain directory. The conditions to check are
1) Check if the file exists in the current directory.
2) Check if the destination directory... (2 Replies)
Discussion started by: madhunk
zipgrep - search files in a ZIP archive for lines matching a pattern
zipgrep [egrep_options] pattern file[.zip] [file(s) ...] [-x xfile(s) ...]
zipgrep will search files within a ZIP archive for lines matching the given string or pattern. zipgrep is a shell script and requires
egrep(1) and unzip(1L) to function. Its output is identical to that of egrep(1).
The pattern to be located within a ZIP archive. Any string or regular expression accepted by egrep(1) may be used. file[.zip] Path
of the ZIP archive. (Wildcard expressions for the ZIP archive name are not supported.) If the literal filename is not found, the
suffix .zip is appended. Note that self-extracting ZIP files are supported, as with any other ZIP archive; just specify the .exe
suffix (if any) explicitly.
An optional list of archive members to be processed, separated by spaces. If no member files are specified, all members of the ZIP
archive are searched. Regular expressions (wildcards) may be used to match multiple members:
* matches a sequence of 0 or more characters
? matches exactly 1 character
[...] matches any single character found inside the brackets; ranges are specified by a beginning character, a hyphen, and an end-
ing character. If an exclamation point or a caret (`!' or `^') follows the left bracket, then the range of characters within
the brackets is complemented (that is, anything except the characters inside the brackets is considered a match).
(Be sure to quote any character that might otherwise be interpreted or modified by the operating system.)
An optional list of archive members to be excluded from processing. Since wildcard characters match directory separators (`/'),
this option may be used to exclude any files that are in subdirectories. For example, ``zipgrep grumpy foo *.[ch] -x */*'' would
search for the string ``grumpy'' in all C source files in the main directory of the ``foo'' archive, but none in any subdirectories.
Without the -x option, all C source files in all directories within the zipfile would be searched.
All options prior to the ZIP archive filename are passed to egrep(1).
egrep(1), unzip(1L), zip(1L), funzip(1L), zipcloak(1L), zipinfo(1L), zipnote(1L), zipsplit(1L)
The Info-ZIP home page is currently at
zipgrep was written by Jean-loup Gailly.
See attributes(5) for descriptions of the following attributes:
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|Availability | SUNWunzip |
|Interface Stability | External |
Source for unzip is available on http://opensolaris.org.
Info-ZIP 28 November 2007 ZIPGREP(1L)