I need to implement some text, date, into another text file. For instance, first line in 7 line and second line in 10 line of another text file?
Thanks in advance.
You could use sed for this, see also 'man sed'.
For your example you could prepare a command file (stored in file 'comm'):
-
7 i lineSeven
-
10 i lineTen
-
The first column is the line number, the second the command ('i' for insert) and the third the new line.
If you then invoke sed on your file to be changed (name: myFile):
The output will have new lines 7 and 10.
You may want to redirect things to a new file:
-
sed -fcomm >myNewFile <myFile
-
HTH,
arne