Hi Guys,
I have following script which counts number of tilde in file but i want to count tilde which are field saparator.but my script count tilde between word also what i need is if line is like
abcd~das~1212~fsddf~
so tilde count is = 4
if line like
abcd~das~1212~fsd"~"df~
so tilda count is =4 onlly it should not give count as 5 that means it should ignor ~ between "~" if it comes in between the any word. Please give me solution in my script only.
#!/bin/bash
WORK_DIR=/export/opt/rtrupld/autosys/scripts_old
DATA_DIR=/cdirect/rtrupld/incoming/intellect
DATA_DIR1=/cdirect/rtrupld/incoming/opics
data1=$DATA_DIR/INTELLECT_TOK_MMRTRCASHFLOW*.txt
if [ $var1 = "INTELLECT" ] && [ $var2 = "TOK" ]
then
echo"-------------------------------ERROR IN CASHFLOW HANDOFF-------------------------------------------------"
{
nawk -v v1=`grep "INTELLECT_TOK_CASHFLOW_FLD_COUNT" $propfile | cut -d"=" -f2` -F'~' '{if (NF-1 != v1)
{print "Error in " $0 " at line number "NR " tilde count= " NF-1 }}' $data1
}
Here path just ignore it properties file value of INTELLECT_TOK_CASHFLOW_FLD_COUNT" is take count of tilde
Thanks & Regards,
Ganesh.