I need a bash script, that reads the line with the fewest number of numbers (not characters) and the largest number of entries into two files.
the original file will be something like:
1 34 5 6 7
23 45 56 67 45 6 5 4
2 3
5 6 7
So in this example i want to read line 2 into an output file A.dat and line 3 into an output file B.dat
numbers can be all way up to the 10000's and are always separated by a space. The number of lines per file may vary but shouldn't be more than 20 or 30.
I can read the file, but after that I get stuck. This is what I have got so far:
PHP Code:
#!/bin/bash
var=0;
while read line
do
echo $line;
var=`expr $var + 1`;
done < "myfile"
echo $var;
Bookmarks