Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AAAAAA
- BBBBBB
- 11111 22222 33333
- 22222 11111 33333
- AAAAAA2222233333
- BBBBBB2222233333
- 22222AAAAAA33333
- 22222BBBBBB33333
- FILES=/directory/*
- cat file1 | while read line ;do
- for f in $FILES; do
- cat $f | sed 's/11111/$i/g' > newfiles/$f$i.txt
- done
- done
- !/bin/bash
- i=1
- FILES=./other_file*
- while read r; do
- for f in $FILES; do
- sed "s/11111/$r/g" > newfiles/file$i.txt < $f
- i=$(( i + 1 ))
- done
- done <file1
- awk -v OFS= '
- NR==FNR {t[NR]=$0; next}
- {s = $0}
- {
- for(i in t) {
- $0 = s;
- sub(/11111/,t[i]);
- $1=$1;
- print > "newfile" ++n
- }
- }' file1 file2 file3
- $ head newfile*
- ==> newfile1 <==
- AAAAAA2222233333
- ==> newfile2 <==
- BBBBBB2222233333
- ==> newfile3 <==
- 22222AAAAAA33333
- ==> newfile4 <==
- 22222BBBBBB33333
Add Comment
Please, Sign In to add comment