I have a file containing 4 columns.
need to scan that file, if all the rows in the column4 have a value ZERO, it should print "everything is fine".
And if all are not ZERO , at the first encounter of non ZERO value of 4th column it should print "some problem "
may be a silly question, but at current moment.. i am unable to think of anything. please help.
I have used a code that scans each line and says..if its fine or some problem.
Well, it is an edge case, being last. Your thinking is too procedural too soon. Assuming spaces as column separators, then logically, the test is, can you find a line not ending in space-zero? If they are all good, you have to look at all, but if any is bad, that is all you need to see, which is the possibility of less work:
In awk, the procedure is to 1) find the first bad, then print bad message and exit, and 2) at last line (if you survive), print good message. i am not an awk fan, I use sed, and do it as a data transformation:
Last edited by DGPickett; 01-10-2011 at 02:49 PM..
I want to search a keyword in a list of pdf files and when i find a match i want to write the title and author of that pdf file to another file. How will I do this using linux shell script? (7 Replies)
Hi,
I have a requirement to scan Oracle's alert log file. This file logs all event for Oracle database and each line will have timestamp followed by messages (which might be one or more lines).
Example.
Thu Aug 15 17:35:59 2013
VKTM detected a time drift. Please check trace file for more... (1 Reply)
Hello,
I have two files as the following:
File1:
F0100020 A G
F0100030 A T
F0100040 A G
File2:
F0100040 A G BTA-28763-no-rs 77.2692
F0100030 A T BTA-29334-no-rs 11.4989
F0100020 A G BTA-29515-no-rs 127.006
I want to sort the second file based on the... (6 Replies)
Hi,
I have two input files as
File1 :
ABC:client1:project1
XYZ:client2-aa:project2
DEF:client4:proj
File2 :
client1:W-170:xx
client2-aa:WT-04:yy
client4:L-005A:zz
Also, array of valid values can be hardcoded like
Output :
ABC:W:project1
XYZ:WT:project2 (1 Reply)
Match column 3 in file1 to column 1 in file 2 and replace with column 2 from file2
file 1 sample
SNDK 80004C101 AT
XLNX 983919101 BB
NETL 64118B100 BS
AMD 007903107 CC
KLAC 482480100 DC
TER 880770102 KATS
ATHR 04743P108 KATS... (7 Replies)
Hi, Iam new to unix. I have one input file .
Input file :
ID1~Name1~Place1
ID2~Name2~Place2
ID3~Name3~Place3
I need output such that only first column should change to fixed width column of 15 characters of length.
Output File:
ID1<<12 spaces>>Name1~Place1
ID2<<12... (5 Replies)
file1.txt :
india pakistan bangladesh
japan canada africa
USA srilanka Nepal
file2.txt
Delhi
Tokyo
washington
I have to cut the first column of file1.txt and apend it with file2.txt as another column like this
Delhi india
Tokyo japan
washington USA
... (4 Replies)
Is there any way to look for a directory path that is listed any number of lines *before* a keyword in an error message?
I have a script that is trying to process different files that are always down a certain portion of a path, and if there is an error, then says there is an error, contact... (2 Replies)
Hello
I am a novice shell scripting programmer, so please bare with me.
I have embedded a simple SQL statement into a shell script, which simply returns an integer (its a count (*) statement).
The result of the statement is then oputput to .txt file. So, the number could be 0, 1,2, 10,... (4 Replies)