SHELL OR PERL QUESTION
Posted
by user150674
on Stack Overflow
See other posts from Stack Overflow
or by user150674
Published on 2010-04-23T16:01:22Z
Indexed on
2010/04/23
16:03 UTC
Read the original article
Hit count: 660
I have a very large file, named 'ColCheckMe', tab-delimited, that you are asked to process. You are told that each line in 'ColCheckMe' has 7 columns, and that the values in the 5th column are integers. Using shell functions indicate how you would verify that these conditions were satisfied in 'ColCheckMe'
K got this...
nawk ‘
NF != 7 {
Printf(“[%d] has invalid [%d] number of fileds\n”, FNR, NF)
}
$5 !~ /^[0-9]+$/ {
Printf(“[%d] 5th field is invalid [%s]\n”, FNR, $5)
}’ ColCheckMe
Now, 2. In with the similar file, you are told that each value in column 1 is unique. How would I verify that?
- Also write a shell function that counts the number of occurrences of the word “SpecStr” in the file 'ColCheckMe'
Any one can help in SHELL or everything including the first in PERL Scripting.
© Stack Overflow or respective owner