omran
1
hi,
i have a very big file that holding data, how could i pick line by line from this file.
the following process can illustrate better:
file
-------------------
123444444 |
122314567 |-----------data
146689000 |
c=123444444 ---------- c is variable
process c ----------- passing c to script (sh,sql....etc)
c=122314567 ---------- c is variable
process c ----------- passing c to script (sh,sql....etc)
c=146689000 ---------- c is variable
process c ----------- passing c to script (sh,sql....etc)
i think u understand what i want to do
please help
thanx in advance
I'm more of a Perl man, so here it is in perl:
#!/usr/bin/perl -w
while ($c = <>) {
#Process $c here!!!
}
exit 0;
put the above code in a file called something like lineExtract.pl, make it executable, then you can do the following to use it:
./lineExtract.pl <big_file_to_process
$c will contain the information one line at a time!
omran
3
thanx Wintellect ..... how could i represent this with SH
#!/usr/bin/ksh
exec < datafile
while read c ; do
somescript $c
done
exit 0
Whether or not this will work with sh depends on which version of sh. If it has the read statement, it should work.