sed

sed (stream editor) is the archetype Unix wonder. I have a fond memory of learning the tool in my teenage.

  • Using rules from a file
sed -f rules.txt target.dat

where rules.txt contains the set or rules, e.g., to change times in subtitles:

s/--> 00:00:02,763/--> 00:00:02,680/
s/--> 00:00:03,705/--> 00:00:03,621/
s/--> 00:00:04,580/--> 00:00:04,506/

See also

  • awk is pretty powerful.
  • jq is the same as sed but for JSON data.