I have not used Unix in a very long time and I am very rusty. I would appreciate any help I can get from the more experienced and experts in Shell script.
I am reading one file at a time from a folder. The file is a flat file with no delimeters or carriage return. Col1 through col6 is the header section and should be read once. Col7 - 14 is the body and can have 1 or multiple records. I read the file check to make sure none of these fields are blank. If there is a blank field, I would like to write a message to a log file that can be viewed later. I haven't gotten to the log file yet. Just trying to read the file with an inner loop just doesn't seem to work. Please help me.
Thank you all for your help.
Last edited by jim mcnamara; 01-28-2010 at 11:31 AM..
Reason: corrected code tags
I have multiple files in this folder with the following names
file.10.5232004
file.12.2112003
.........
What do I do?
Thanks for your help again.
---------- Post updated at 03:40 PM ---------- Previous update was at 02:10 PM ----------
Thanks I got the code to work.
The problem I am having now is that it is repeating the same thing over and over again in the report.txt file.
If I wanted to print out only the file name, number of records and the length of each record for each file, how do I do this? with the code below
Thank you
---------- Post updated 01-29-10 at 12:47 AM ---------- Previous update was 01-28-10 at 03:40 PM ----------
Thank you!! I was able to find a solution in the forumn
---------- Post updated at 03:26 PM ---------- Previous update was at 12:47 AM ----------
I am having a hard time extracting the file name from the above code. In stead of printing /folder/file.1$.5$, I would like it to print the file name file.1$.5$.
I have tried using basename but it looks like NAWK or AWK does not recognise basename. Each time I type it in, it prints out the word basename
Thank you for your help!!!
---------- Post updated at 03:27 PM ---------- Previous update was at 03:26 PM ----------
I am having a hard time extracting the file name from the above code. In stead of printing /folder/file.1$.5$, I would like it to print the file name file.1$.5$.
I have tried using basename but it looks like NAWK or AWK does not recognise basename. Each time I type it in, it prints out the word basename
i have almost the same problem with my files (i am on AIX 5.3), i am gonna try this solution
The main difference that in my case i don't have header but also i can't use "pos.txt"
because i have offest like that
so is there another way to fit for my purpose
thx jim for your great work and thx asemota for asking so i could fond a solution
I/m a beginner so be easy. I have text files that live on an AIX server. The files come in and I've been charged with writing a shell script to email out that pulls the first date, and the last date of the file. I need to load these 2 dates into 2 separate variables. I can figure out the variables,... (13 Replies)
Hi,
I want to know if there is any simple approach to SUM a field based on group by of different fields
for e.g.
file1.txt contains below data
20160622|XXX1||50.00||50.00|MONEY|Plan1|
20160622|XXX1||100.00||100.00|MONEY|Plan1|
20160623|XXX1||25.00||25.00|MONEY|Plan1|... (3 Replies)
Hello All,
I have the following file. The first column is Type. Always the file will have one H and one T type in between all D type reocrds.
Need todo some validations.
H|ABCD
D|TAB N0003107809CD2013-11-14|RYAN|FRY|7 DR|RICHMOND HILL|GA|32431|X|C95|000009999|000000001|TAB||C0001
D|TAB... (3 Replies)
I have a flat file A.txt with field seperate by a pipe
2012/11/13 20:06:11 | 284:hawk pid=014268 opened Locations 12, 13, 14, 15 for /home/hawk_t112/t112/macteam/qt/NET12/full_ddr3_2X_FV_4BD_1.qt/dbFiles/t112.proto|2012/11/14 15:19:26 | still running |norway|norway
2012/11/14 12:53:51 | ... (6 Replies)
Hello Gurus !
I have what probably amounts to a few simply changes to fix; however for the life of me I cannot seem to get it ti work. I need to align the output of my script (I am writing to a logfile)... here's the lines in my code:
if
then
echo "NODE: $node" >> $logfile... (6 Replies)
i need to verify whether the ip adress given as input to the shell script is pingable or not... that is whether the ip is alive and responding..
ping $ip_adress
the above wont work in script because the execution is continuous... so the shell script keeps will dwell in this pinging process...... (8 Replies)
Pardon my ignorance but I am lost on how to do this
I have a file called "Sample.txt", it is pipe delimited, it should have 13 fields. But some of the records do not, I would like to set up a shell script
where I can pass in a parameter "Sample.txt" and it would split the file into records... (2 Replies)
Hi,
the below script is to get & check the correct values for minutes (0-59) that is inputed by user :
printf "$FBOLD\nPlease enter the minutes (0-59): $FREG"
read MIN
case "$MIN" in
|) break 2;;
*)
echo ""
echo "Invalid minutes, please... (4 Replies)
Yes, i did... let me state my problem in more detail
Inputs:
I have one input CSV file
And, i have stored no. of comma each line should in a variable.
e.g.
$ cat cmt.csv
this, is a ,comma ,count test1
,,this, is a ,comma ,count test2
this, is a ,comma ,count test3... (6 Replies)
All
Can you help me to validate a variable only for string and digit. That is
variable should either fully alphabets or digits.
Please send me result to my mail id also: REMOVED
Thanx in advance
Regards
Deepak Xavier (1 Reply)