Sed
Jump to navigation
Jump to search
Apply edit command to file and sends to output:
sed -e "<edit command>" <file> > <output>
Apply all edit commands in sedfile:
sed -f <sedfile> <file> > <output>
Some basic edit commands:
s/a/b/ substitute b for a {range}d delete lines in range
To append .img
to the end of each line:
sed -e "s/$/.img/" <file>
or (if there is already a tab at the end of each line)
sed -e "s/\t$/.img/" <file>
To modify a file in-place, use the -i option:
sed -e 's/\sgutsy/ hardy/g' -i /etc/apt/sources.list