If I use the grep command for parsing files, does it stop parsing right after it finds the matching pattern or does it continue to parse that document?
If I use the grep command for parsing files, does it stop parsing right after it finds the matching pattern or does it continue to parse that document?
Most implementations of the awk utility will stop reading the current file when a match is found when the -l is given on the command line. (There is no requirement that grep quit reading the file when a match is found, but it is more efficient if it is done that way and most implementations of grep try to be efficient.) Note also that if the data being read is from standard input rather than from a path operand given on the command line, that might be treated differently.
This User Gave Thanks to Don Cragun For This Post:
I have seen this code in a few places and my understanding is they are using it to determine what app called the script.
I have a script that is called by two different applications and what it to do one thing when called by one and something else when called by the other. How do I determine... (1 Reply)
i have this line of code that looks for the same file if it is currently running and returns the count.
`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`
basically it is assigned to a variable
ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
I have the following line of code that works wonders. I just don't completely understand it as I am just starting to learn regex. Can you help me understand exactly what is happening here?
find . -type f | grep -v '^\.$' | sed 's!\.\/!!' (4 Replies)
I have the following code. I want to remove the --sort=num/num/... and am
using grep to exclude it as shown below:
I have a bit of problem figuring out the use of - at the front
echo "--sort=4/5/6" | grep -ivE '-((sort|group)=+/+(/+)*)$'
Now suppose I want to remove --quiet
I can... (7 Replies)
Basic:
find . -type f -name “*.txt” -print | awk '{gsub("Ontem", "AntesdeOntem", $0); print > FILENAME}' *.txt
The idea is in folder /home/myapontamentos
I have some files and i need to change in all them the word "ontem" to "antesdeontem".
But bigger files are cut (size i mean)... (4 Replies)
hey peeps
ive made my first script, its for my work made in HP-UX, kshell
anyways
the script copies 3 files from a spider system to the floppydrive of my collegeau, I want to check if there is a floppy in the drive otherwise the script just runs forever and I don't have that time a day... (1 Reply)