10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I have a file like below with more than 30,000 lines:
Someword "mypattern blah blah mypattern blah mypattern blah "
Someotherword "mypattern blah blah mypattern blah mypattern blah"
Someword "mypattern blah blah blah mypattern blah "
Someword "mypattern blah blah mypattern blah ... (3 Replies)
Discussion started by: ctrld
3 Replies
2. Shell Programming and Scripting
Hi all,
I have file on which I do grep on "/tmp/data" then I get 5 lines as
dir Path: /tmp/data/20162343134
Starting to listen on ports logging:
--
Moving results files from local storage: /tmp/resultsFiles/20162343134/*.gz to NFS: /data/temp/20162343134/outgoing
from above got to get... (7 Replies)
Discussion started by: girijajoshi
7 Replies
3. Shell Programming and Scripting
I have one requirement to delete all lines from a file if it matches below scenario. File contains three column. Employee Number, Employee Name and Employee ID
Scenario is: delete all line if Employee Number (1st column) contains below
1. Non-numeric Employee Number
2. Employee Number that... (3 Replies)
Discussion started by: anshu ranjan
3 Replies
4. Shell Programming and Scripting
I have a directory of files, each with a variable (though small) number of lines. I would like to go through each line in each file, and print the:
-file name
-line number
-number of matches to the pattern /comp/ for each line.
Two example files:
cat... (4 Replies)
Discussion started by: pathunkathunk
4 Replies
5. Shell Programming and Scripting
Hi,
I am trying with the below Perl command to print the first field when the second field matches the given pattern:
perl -lane 'open F, "< myfile"; for $i (<F>) {chomp $i; if ($F =~ /patt$/) {my $f = (split(" ", $i)); print "$f";}} close F' dummy_file
I know I can achieve the same with the... (7 Replies)
Discussion started by: royalibrahim
7 Replies
6. Shell Programming and Scripting
Hi I have a file like this
Record 182: Rejected
No Data found
Record 196: Rejected
File Not Found
Record 202: Rejected
Invalid argument
Record 212: Rejected
Bad data
My requirement is to search for the value "Record" and if found, then return the next line of it.
So,... (3 Replies)
Discussion started by: mr_manii
3 Replies
7. Shell Programming and Scripting
but keep if does not
I have a file: --> my.out
foo: bar
foo: moo
blarg
i am on vacation
foo: goose
foo: lucy
foo: moose
foo: stucky
groover@monkey.org
foo: bozo
grimace@gonzo.net
dear sir - blargo blargo
foo: goon
foo: sloppy
foo: saudi
gimme gimme gimme (3 Replies)
Discussion started by: spacegoose
3 Replies
8. Shell Programming and Scripting
i have a file in this pattern
MATCH1 word1 IMAGE word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1 word2 word3 word4
MATCH1 word1 IMAGE word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1... (7 Replies)
Discussion started by: bangaram
7 Replies
9. Shell Programming and Scripting
Hi All,
I would like my code to be able to print out the whole line if 1st field has a dot in the number. Sample input and expected output given below.
My AWK code is below but it can;t work, can any expert help me ?
Thanks in advance.
{if ($1 ~ /*\.*/) { print $0 }}
Input:
... (2 Replies)
Discussion started by: Raynon
2 Replies
10. Shell Programming and Scripting
i have an awk statement which i am using to count the number of occurences of the number ,5, in the file:
awk '/,5,/ {count++}' TRY.txt | awk 'END { printf(" Total parts: %d",count)}'
i know there is a total of 10 matches..what is wrong here?
thanks (16 Replies)
Discussion started by: npatwardhan
16 Replies