Results 1 to 2 of 2
I otherwise wouldn't ask this, but after a long time searching the internet for what I thought would be a quick and simple answer, I haven't found it
So then, ...
- 07-16-2007 #1Just Joined!
- Join Date
- Jul 2007
- Posts
- 1
Saving Changes After Sed Command?
I otherwise wouldn't ask this, but after a long time searching the internet for what I thought would be a quick and simple answer, I haven't found it

So then, I'm pretty new to Linux and BASH and I'm trying to make a shell script to remove a column from a tab-delimited .dat file, put it in a new folder, remove all instances of a certain string (%) and save the changes.
The replacement change doesn't save though, and I can't find the command to make it do so. So how can I?#!/bin/bash
cat ./wReadings.dat | cut -f 3 - > humidity.dat
cat ./humidity.dat | sed 's/%//'
Thanks a lot.
- 07-16-2007 #2
You could just redirect the results to a new file.
Or read the manpages for sed(1):
-i extension
Edit files in-place, saving backups with the specified extension.
If a zero-length extension is given, no backup will be saved. It
is not recommended to give a zero-length extension when in-place
editing files, as you risk corruption or partial content in situ-
ations where disk space is exhausted, etc.


Reply With Quote