File extraction without awk

Hello everybody,

Here is my problem : I cannot find a way to extract data from a particular file and more precisely I cannot extract the result of my awk script to an external file because I am currently working on HP-UX.

I would like a simple script (without awk) which asks for a date like below :

Enter the date :

Then you enter 02/12/2010 (for instance)

Then the script would check a csv file for related actions and comments and informations for the date previously entered and finally extract the result for this date in an external file, without awk. Is it possible ?

csv file

1/12/2010;;;
Action_1;"XXXZZ24";Comment1;"Comment2"
Action_2;"XXXZZ25";Comment1;"Comment2"
Action_3;"XXXZZ26";Comment1;"Comment2"
Action_4;"XXXZZ27";Comment1;"Comment2"
Action_5;"XXXZZ28";Comment1;"Comment2"
Action_6;"XXXZZ29";Comment1;"Comment2"
Action_7;"XXXZZ30";Comment1;"Comment2"
02/12/2010;;;
Action_8;"XXXZZ31";Comment1;"Comment2"
Action_9;"XXXZZ32";Comment1;"Comment2"
Action_0;"XXXZZ33";Comment1;"Comment2"
Action_1;"XXXZZ24";Comment1;"Comment2"
Action_5;"XXXZZ35";Comment1;"Comment2"
Action_6;"XXXZZ36";Comment1;"Comment2"
Action_2;"XXXZZ25";Comment1;"Comment2"

Thanks a lot

awk works on HP-UX. why don't you want awk ?

Try this:

echo "enter date"
read dd
while read line
do 
  case $line in 
    *$dd*) found=true ;;
    [0-9]*/*/*) found=false ;;
  esac; 
  if [ $found = true ]; then
    printf "%s\n" "$line"
  fi
done < infile > outfile

He probably doesn't have GNU awk, ergo a lot of foreign awk scripts won't work.

Thanks a lot for your help, evrything is OK now, I only have the things I want in the output file.
:b: :slight_smile: