I have used this code :
It displays the Output with file name.
How to display the output without file name using the above command.
Regards,
Nanthagopal
The grep utility always includes the filename when more than one file is given on the command line so you determine where the matched line came from. Using xargs the way you are here will usually invoke grep with several file operands, but may invoke grep with only one file operand if find only finds one file to process or the xargs ends up with a single file arg on the last invocation of grep. If you want to be sure that grep is only called with one file operand, skip the xargs element of your pipeline and just use a -exec primary in the find command: ---------- Post updated at 06:40 AM ---------- Previous update was at 03:15 AM ----------
Quote:
Originally Posted by RudiC
... ... ...
I still wonder why nanthagopal's disk fills up, though ...
The original command posted by nanthagopal was:
The > test.txt creates text.txt as a regular file in the current directory. With "." being the root of the file hierarchy being searched by find, it will eventually reach a point where find invokes the command:
with the output being appended to test.txt while it is being read. If the amount of text in the file when grep gets to it is small enough, it may hit end-of-file before it gets stuck in a loop copying previously matched lines to the end of the test.txt recursively until the disk fills up or the maximum file size limit is reached.
Later suggestions in this thread avoid the problem by excluding test.txt from the list of files to be processed by grep:
Another way to avoid the problem is to direct the output to a file outside of the file hierarchy being search by the find, such as:
It is true that some versions of the grep utility will refuse to process a file operand if it names the output file, but that is not required by the standards, and can't be relied upon in a portable script.
The grep -h option isn't in the standards, but it is present in all of the man page sets available in the Man Pages tab on this site. Thanks to agama for pointing out this option.
please help to write a awk command-line programs to achieve the following functions: Thank in advance.
Requeset Description:
compare two files f1 and f2, export to file f3:
1 Delete duplicate rows of in file f1 and file f2
2 If the 1th column of file f1 and file f2 is the same, then export... (1 Reply)
I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file.
Please use CODE tags as... (7 Replies)
Hi guys,
I have a text file named file1.txt that is formatted like this:
001 , ID , 20000
002 , Name , Brandon
003 , Phone_Number , 616-234-1999
004 , SSNumber , 234-23-234
005 , Model , Toyota
007 , Engine ,V8
008 , GPS , OFF
and I have file2.txt formatted like this:
... (2 Replies)
Dear All
I am having a text file which is having more than 200 lines.
EX:
001010122 12000 BIB 12000 11200 1200003
001010122 2000 AND 12000 11200 1200003
001010122 12000 KVB 12000 11200 1200003
In the above file i want to search for string KVB... (5 Replies)
I am having a text file which is having more than 200 lines.
EX:
001010122 12000 BIB 12000 11200 1200003
001010122 2000 AND 12000 11200 1200003
001010122 12000 KVB 12000 11200 1200003
In the above file i want to search for string KVB and add/replace... (1 Reply)
Hi ,
I have a simple text file with contents as below:
12345678900 971,76 4234560890
22345678900 5971,72 5234560990
32345678900 71,12 6234560190
the new csv-file should be like:
Column1;Column2;Column3;Column4;Column5
123456;78900;971,76;423456;0890... (9 Replies)
hi, i'm new to shell scripting.
I have a text file(sample.txt). It contains the different username & password for different users of oracle db.
.txt content
user1|password1
user2|password2
user3|password3
user4|password4
First read the text file and take the username and password then... (5 Replies)
Hi,
So I'm kinda new to shell scripts and the like. I've picked up quite a bit of use from browsing the forums here but ran into a new one that I can't seem to find an answer for.
I'm looking to parse/find a string AND the next 15 or so charachters that follow the string within a text file... (1 Reply)
Hi, I'm trying to output all text from the first paragraph in a file that contains a specific string through the last paragraph in that file that contains that string.
Previously, I was outputting just each paragraph with that search string with:
cat in_file | nawk '{RS=""; FS="\n";... (2 Replies)