I have:
Location.txt (content)
some_line1
some_line2
some_line3
region.txt (content)
region1
region2
region3
uri.txt (content)
/some_text/some_text1/***/
/some_text/***/some_text2/
/***/some_text/some_text3/
I need to create files
region1
region2
region3
and each of them have to fill with the following (name of the region instead of stars)
Example of file region1
/some_text/some_text1/region1/
some_line1
some_line2
some_line3
/some_text/region1/some_text2
some_line1
some_line2
some_line3
/region1/some_text/some_text3
some_line1
some_line2
some_line3
Example of file region2 (name of the region instead of stars)
/some_text/some_text1/region2/
some_line1
some_line2
some_line3
/some_text/region2/some_text2
some_line1
some_line2
some_line3
/region2/some_text/some_text3
some_line1
some_line2
some_line3
Now I have
#!/bin/bash
while read region
do
while read uri
do
echo $uri >> "/home/user/regions/$region"
done < uri.txt
done < region.txt
This script creates files with names of lines from region.txt
and fill it with lines from uri.txt
.
But I have to make a lot of files. Each file should be filled with many locations but one line in each location should be changed to line from uri.txt
.
Looks like I have to use
cat $file|sed 's/^was/now/'
but I dont know how to use it.
Any help please.