![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| shell script to search content of file with timestamps in the directory | psychobeauty | Shell Programming and Scripting | 10 | 04-21-2008 02:37 AM |
| Shell script for text extraction from a file | vignesh53 | Shell Programming and Scripting | 3 | 02-05-2008 05:16 AM |
| search for the contents in many file and print that file using shell script | cdfd123 | Shell Programming and Scripting | 3 | 10-07-2007 07:17 PM |
| Shell script to return all the ID's from file based on the distribution ID search | kumbhatalok | UNIX for Dummies Questions & Answers | 1 | 10-06-2006 09:53 AM |
| Korn Shell Script - Read File & Search On Values | run_unx_novice | Shell Programming and Scripting | 2 | 06-15-2005 04:20 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#8
|
|||
|
|||
|
kja328: grep and friends work on text files; as long as the words you want to look for are visible in the file with "less" or some such, it should still work. You might get accidental matches in Word and Excel files because they contain a lot of metadata, including stuff which used to be visible in the file but which was subsequently deleted.
psychobeauty: To put this in a script which accepts the regular expression to search for as an argument, use "$1" as a placeholder. Shell scripts receive their positional arguments in $1, $2, $3 etc. $# will contain the number of arguments. Code:
#!/bin/sh
case $# in 1) ;; *) echo "syntax: $0 regex" >&2 ; exit 2;; esac
find /opt/efx/ian/original -name '*' -exec grep -l "$1" {} \; -exec cp {} /opt/efx/ian/copied \;
|
| Forum Sponsor | ||
|
|
|
#9
|
||||
|
||||
|
Hi.
See grep and binaries - Linux Forums for additional suggestions on search MS Word files with *nix utilities ... cheers, drl |
|
#10
|
|||
|
|||
|
Quote:
Thanks, -Kiran |
|||
| Google The UNIX and Linux Forums |