Hi
I am trying to write a script in Bash Shell. I have the file test.txt and has the following data:
AIR DR
[ 4] Pressure :50
AIR UR
[ 3] Pressure :70
WATER DR
[ 3] Pressure :90
[ 3] PIS: 402ps
WATER UR
[ 3] Pressure :110
[ 3] PIS: 402ps
Now i want to store each category's data in separate file.. For example :
AIR DR
[ 4] Pressure :50
in AIR DR.txt file
and simliarly the rest of the data in 3 other files.
I am able to read the file but I am not able to store them in different files.
Here is what I did to read the file:
while read line
do
echo $line >> line.txt
done <results.txt
Please help I am new to bash scripting!..