Reputation: 1911
I have many files named 0.250, 0.252, 0.254 .... and each file contains some numbers, like
0.2520 0.2520 0.2520
0.2520 0.2520 0.7440
0.2520 0.7440 0.2520
0.7440 0.2520 0.2520
and I want to paste a column
1
2
3
4
to each file, so my files 0.250, 0.252 .. to be modified as
1 0.2520 0.2520 0.2520
2 0.2520 0.2520 0.7440
3 0.2520 0.7440 0.2520
4 0.7440 0.2520 0.2520
I tried paste command, but this doesn't change the actual file..
Upvotes: 0
Views: 738
Reputation: 212248
It looks like you want:
for file in *; do
nl "$file" > "$file.numbered"
done
Upvotes: 1
Reputation: 41
You can redirect the output of the paste command to a file...
paste file1 file2 > outputfile
Consider creating new files, and then removing the old ones instead of replacing them on the spot. It is much much safer...
Upvotes: 1