#!/bin/sh
date=`date +%y%m%d -d"1 day ago"`
inbound_dir=/vis/logfiles/to_solmis
cp `grep -il ST~856~ $inbound_dir/*$date*` /vis/sumit/in_ASN/
echo 'SENDER,RECEIVER,DATE,TIME,ASNUMBER' > a.csv
for i in /vis/sumit/in_ASN/*
do
mkdir -p /vis/sumit/inboundasns.$date
cp `echo $i` /vis/sumit/inboundasns.$date
tr -c '[A-Z] [0-9] [a-z] ~' '[ *]' <$i > b
awk -F "DTM~" '{print $1}' b > c
awk -F "~SH~" '{print $2}' c > d
awk -F "~" '{print $1","$2","$3","$4","$11}' d >> a.csv
done
Please suggest how to read or print a file which is of 3000 bytes using awk command..
Error is awk cannot read a file whose length is greater than 3000.
Any alternative ????
This is the difference.
There is no limit of file size.
There's a limit of record lenght.
Use nawk, gawk.
GNU awk is gawk. It's for many distributions.
I entered nawk instead of awk but didnt work.
error is: nawk not found.
My OS HP-UX.
my script is not able read the file and pick up the required fields when the total size of record was greater than 3000 bytes.
Error looks like:
awk: Input line ISA~00~ ~00 cannot be longer than 3,000 bytes.
The source line number is 1.
Every file contain such type of data varying in record length.
I need to read all records & pick up fields from the record that are in red and store it .csv file.
For this I wrote a script.
I am beginner,I dont know how to use FS in awk command.