Results 1 to 1 of 1
Creation sequence automatic of files once modify something on them
I would like to find the way to automate the modification inside a file and saved it with different name.
...
- 04-13-2009 #1Just Joined!
- Join Date
- Apr 2009
- Posts
- 1
Creation sequence automatic of files once modify something on them
Creation sequence automatic of files once modify something on them
I would like to find the way to automate the modification inside a file and saved it with different name.
I have the file 'memo53' with the data:
#!/bin/bash
clear
echo “knowledge is power”
position <1, 2, 3>
option 1
I would like to create a shell script to read the file memo53 and if find ‘position’ then add 1 to 1, 1 to 2, and 1 to 3, and if find as well ‘option’ add 0.5 to 1 and saved it as memo54,
Repeat the process of addition and saved as memo55.
but it is not able to automatically create the files in sequence and not make the sum.
No sure if I could do it with for loop:
for file in memo53 memo54 memo55
do
while read line
do
grep location | `expr $2 + 1`
grep location | `expr $3 + 1`
grep location | `expr $4 + 1`
grep option | `expr $2 + 0.5`
done < memo53
done
file > memo*
or should be better start with a count
count=1
if [ count –eq 3]
then
exit
else
while read line
do
grep location | `expr $2 + 1`
grep location | `expr $3 + 1`
grep location | `expr $4 + 1`
grep option | `expr $2 + 0.5`
done < memo53
fi
file > memo55
let count+=1


Reply With Quote