Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I have a file report.txt which has the contents as:SheetName|RecordName|FieldName|TableName|ColumnName|Change
Summary||2||No specification received for output file record|MODIFIED
Central Checks|R3002SPLDXVOLUME|F3002-VOL1-VOL-SRL-NUM|SUBMISSION|SERIAL_NUM|DEL
ETED
Suspense data|RC3310SUSPMIGXDATA||||ADDED
Suspense data|RC3310SUSPMIGXDATA|FC3310-RECORD-TYPE|||ADDEDand my unix code is:
#!/bin/ksh
set -x
cat report1.txt | while read LINE
do
recordname=`echo $LINE | awk -F"|" '{print $2}'`
change=`echo $LINE | awk -F"|" '{print $6}'`
if test ! "$recordname" || test "$change" = "ERROR"
then
echo "something"
fi
done
set +xI am checking whether recordname field is empty or change field contains string "ERROR".
But it is giving error.
Tell me the reasonRoopa.A

cat report.txt | while read LINE
do
recordname=`echo $LINE | awk -F"|" '{print $2}'`
change=`echo $LINE | awk -F"|" '{print $6}'`
if [ -z "$recordname" ] || [ "$change" = "ERROR" ]; then
echo "recordname is empty or change is ERROR"
fi
done
Luke Chi

Hi,
Still its not taking the value of changeread LINE
cat report1.txt
+ awk -F| {print $2}
echo SheetName|RecordName|FieldName|TableName|ColumnName|Change
recordname=RecordName
+ awk -F| {print $6}
echo SheetName|RecordName|FieldName|TableName|ColumnName|Change
change=Change
err=ERROR
[ -z RecordName ]
= ERROR ]
See in this last line its checking correctly for recordname but it is not doing for change.Please tell me why its not taking change field value.Thanks
Roopa.A

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |