No. The point of MadeInGermany's post is that creating a pipeline using cat to feed input into a utility that can open files directly is a waste of resources. And, even if the utility doesn't open files directly, you can use redirection in the shell instead of creating an unneeded process and reading and writing a file (cat) and reading the file again (grep in this case).
So, rather than using a pipeline for this, use one of the following instead:
which only read the contents of filename.txt once.
Note also that the standards do not specify a -w option for grep, so this suggestion will not work on many systems. And, on systems that do have grep -w, this command will give false positives if the format of the day in the date field doesn't use a leading 0 on the first nine days of the month. That is, both of the commands:
will match all three of the following lines:
while the commands:
will only match the 1st line (which is what I believe the original poster wanted).
Dear all,
I have gone through all the search and replace requests but none of them meet my particular need. I have a huge file in which all Unicode characters are stored as Names. A sample is given below. I want to replace strings in that file with a mapper from another file termed as master.dic. ... (4 Replies)
Hi!
I'm trying to figure out how to find words with X number of doubles, only. I'm searching a dictionary, (one word per line). For instance, if you want to find words containing only one pair of double letters, you could do something like this:
egrep '(.)\1' wordlist.txt |egrep -v '(.)\1.*(.)\2'... (3 Replies)
Hi,
I need your help for below with shell scripting or perl
I/P
key, Sentence
customer1, I am David
customer2, I am Taylor
O/P
Key, Words
Customer1,I
Customer1,am
Customer1,David
Customer2,I
Customer2,am
Customer2,Taylor (4 Replies)
Queue on node in domain
description :
type : local
max message len : 104857600
max queue depth : 5000
queue depth max event : enabled
persistent msgs : yes
backout threshold : 0
msg delivery seq :... (4 Replies)
How do you negate a literal hyphen/dash in a regex? If it's the first character inside the brackets, then it is read literally.
But if you stick a caret to the left of it, to negate it, then it seems it is no longer read literally. Or whatever, it doesn't work.
Nor does escaping it seem to... (3 Replies)
Hi,
I need to insert space between words on my output in UNIX other than the single space given by the space bar on my keyboard, e.g
when are you going. (There should be 4 spaces between each of these words)
rather than
when are you going
Can anyone help me with... (3 Replies)
I have been trying to find files containing the words AAA, BBB and CCC.
I tried:
grep AAA `grep BBB files*` grep CCC files*
but is does not work
I tried several ways
this is an easy one but I am a dummy, Does anyone can help me?
Thanks
:( (12 Replies)
I have a .txt file which contains several lines of text. I need to write a script program using grep or any other unix tool so as to detect part of the text (words) between / / that begin with the symbol ~.
For example if somewhere in the text appears a webpage address like... (8 Replies)