Need help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help
# 1  
Old 01-02-2012
Need help

Hi,

for security reason,deleting this thread. thx for cooperation and help


Thx

Last edited by kirankumar; 01-02-2012 at 07:34 AM..
kirankumar
# 2  
Old 01-02-2012
Something like this?

Code:
#! /bin/bash
while read x
do
    echo $x
    echo $x | cut -d_ -f2 | egrep -q "20[0-9]{2}(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])"
    [ $? -eq 0 ] && echo "Start date - correct format" || echo "Start date - not correct format"
    echo $x | cut -d_ -f3 | egrep -q "20[0-9]{2}(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])"
    [ $? -eq 0 ] && echo "End date - correct format" || echo "End date - not correct format"
    echo
done < inputfile

# 3  
Old 01-02-2012
thx for all your help
kirankumar
# 4  
Old 01-02-2012
@ balaje, we can use IFS in while loop
Code:
while IFS='_' read v1 v2 v3
do
        echo $v1 $v2 $v3
done < infile

# 5  
Old 01-03-2012
Ah, yes. Even that could be done. Thanks jayan_jay.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question