Read all lines after a string appears in the file.

Hi All,

I want to read all lines after a perticular string {SET UP VALUES}apprears in the file.

SET UP values contains direcory, number of days and file type.

Step1: Read all lines below SET UP VALUES string.
Step2: If set up values are not present in each record then read from default section.
Step3: Check that first value in the set up record is valid directory
by cross checking with DIR list.

 
#{DIR LIST}
PROCESS=/DIR/PATH1
REJECT=/DIR/PATH2
 
#{DEFAULT SECTION}
ALL=$PROCESS,$REJECT
DAYS=80
FORMAT=dat
 
#{SET UP VALUES}
$PROCESS#|#25#|#.dat
$REJECT#|#25#|#.dat
#|#|#|##|#
 

Please let me know if you need any details.

Thanks and Regards
Nagaraja A

Hi Nagaraja Akkiva,

Two doubts:
1.- What does second step mean?
2.- What must be the output?

Regards,
Birei

a delete script which reads number of days, location and file type as the parameters from the config file.

First, it has to check SET UP VALUES.

For example,

if set up value is "$PROCESS#|#25#|#.dat" then
we have to delete all .dat file older than 25 days from processed directory.

Example second: Here , file directory is null then we have to read for default section mentioned. ALL: i.e $PROCESSED and $REJECTED.

#|#25#|#.xls

Hope this is clear now..

Thanks and Regards
Nagaraja AKkivalli.

Use the below code to get those three data in a variables ->"$PROCESS#|#25#|#.dat"

A=`cat 1.txt|sed -n '/SET UP VALUES/{n;p;}'|cut -d'|' -f1`
B=`cat 1.txt|sed -n '/SET UP VALUES/{n;p;}'|cut -d'|' -f2`
C=`cat 1.txt|sed -n '/SET UP VALUES/{n;p;}'|cut -d'|' -f3`

Once u got the data to the variable u can excute the IF loop to peform your condition to check the null values

alternate code .. Useless Use of Cat Award

$ nawk -F\| '/SET UP VALUES/{getline;print $1}' infile