Hi,
I need to verify the next line of the matched pattern in the file and if the next line of the pattern does not match 'SQR' word then delete the lines of the matched pattern.
f.eg : Myfile..
/users/ciim/942ftp.com
-------------------------------------
/users/ciim/abm/com/driverall.com
-------------------------------------
sqr $USR_HOME/driverall.sqr $USR_HOME/driverall.txt
/users/ciim/abm/com/drivers.com
-------------------------------------
sqr $USR_HOME/driver10.sqr ciim/iis $USR_HOME/driver10.txt
sqr $USR_HOME/abm/sqr/driver11.sqr $USR_HOME/driver11.txt
sqr $USR_HOME/abm/sqr/driver12.sqr $USR_HOME/driver12.txt
/users/ciim/942ftp.com
-------------------------------------
/users/ciim/943ftp.com
-------------------------------------
/users/ciim/944ftp.com
-------------------------------------
In the above example I want to search for the pattern..
/users/ciim*
------------
If I find it then I need to check that whether the line that is following the ------- line starts with sqr/SQR.
If this line does not start with sqr/SQR then delete the above two lines of the matched pattern ( /users/ciim*
------------ ).
In the above case my output should like ....
/users/ciim/abm/com/driverall.com
-------------------------------------
sqr $USR_HOME/driverall.sqr $USR_HOME/driverall.txt
/users/ciim/abm/com/drivers.com
-------------------------------------
sqr $USR_HOME/driver10.sqr ciim/iis $USR_HOME/driver10.txt
sqr $USR_HOME/abm/sqr/driver11.sqr $USR_HOME/driver11.txt
sqr $USR_HOME/abm/sqr/driver12.sqr $USR_HOME/driver12.txt
Any and all help will be appreciated. Thanking you in advance.
Thanks.
I need to verify the next line of the matched pattern in the file and if the next line of the pattern does not match 'SQR' word then delete the lines of the matched pattern.
f.eg : Myfile..
/users/ciim/942ftp.com
-------------------------------------
/users/ciim/abm/com/driverall.com
-------------------------------------
sqr $USR_HOME/driverall.sqr $USR_HOME/driverall.txt
/users/ciim/abm/com/drivers.com
-------------------------------------
sqr $USR_HOME/driver10.sqr ciim/iis $USR_HOME/driver10.txt
sqr $USR_HOME/abm/sqr/driver11.sqr $USR_HOME/driver11.txt
sqr $USR_HOME/abm/sqr/driver12.sqr $USR_HOME/driver12.txt
/users/ciim/942ftp.com
-------------------------------------
/users/ciim/943ftp.com
-------------------------------------
/users/ciim/944ftp.com
-------------------------------------
In the above example I want to search for the pattern..
/users/ciim*
------------
If I find it then I need to check that whether the line that is following the ------- line starts with sqr/SQR.
If this line does not start with sqr/SQR then delete the above two lines of the matched pattern ( /users/ciim*
------------ ).
In the above case my output should like ....
/users/ciim/abm/com/driverall.com
-------------------------------------
sqr $USR_HOME/driverall.sqr $USR_HOME/driverall.txt
/users/ciim/abm/com/drivers.com
-------------------------------------
sqr $USR_HOME/driver10.sqr ciim/iis $USR_HOME/driver10.txt
sqr $USR_HOME/abm/sqr/driver11.sqr $USR_HOME/driver11.txt
sqr $USR_HOME/abm/sqr/driver12.sqr $USR_HOME/driver12.txt
Any and all help will be appreciated. Thanking you in advance.
Thanks.