Reputation: 5
I have a .txt file that has 98 lines. I need to shorten each of these lines so that I only have the first 14 characters in each line. How do I go about doing this?
Upvotes: 0
Views: 542
Reputation: 31471
colrm 15 < foo.txt
Looks good and might do what you want.
You will need to direct the output to another file, if you want to save the results.
Upvotes: 0
Reputation: 6062
If Linux:
cut -c -14 myfile.txt > mycutfile.txt
What this does is take the first 14 characters (-14
is a shortcut for 1-14
) of each line of the original file and pipe them out to the new file.
Upvotes: 1