Transfer lines from one file to another
Hello
I have one file that has one line in it. I have to transfer that line to the end of another file but add some numbers before that line and some number after it. So I do something like this: Code:
whatever=`cat otherfile` 22439999121 (if otherfile contains 9999) But now the problem: otherfile sometimes has two lines, e.g. 9999 8888 and what I want in newfile is this: 22439999121 22438888121 Any ideas how I can do that for more than one line? |
Using cat might look like this
Code:
#!/bin/bash Code:
sed -e 's/^.*$/2343&121/' file.txt > newfile.txt |
Quote:
Still one question. If the 2343 part is a variable, how can I put the variable into the code? This doesn't work: Code:
file1=2343 |
Put the variable in single quotes
Code:
sed -e 's/^.*$/'$mudd'&121/' file.txt > newfile.txt |
All times are GMT -5. The time now is 09:32 PM. |