Skip to main content
4 of 4
edited tags
Kusalananda
  • 356.1k
  • 42
  • 737
  • 1.1k

sed "invalid command code W"

I am trying to prepend text to the begging/header of a set of .vtt text files with sed in a loop. I'm not replacing any text, only adding text.

I need some line breaks in the text.

The text should read:

WEBVTT Kind: captions Language: eng File Creation Date: 2023-08 

Here is what I am trying:

for file in *.vtt ; do sed -i '' 'WEBVTT/nKind: captions/nLanguage: eng/nFile Creation Date: 2023-08' "$file" done 

give me the error: sed: 1: 'WEBVTT/nKind: captions/ ...': invalid command code W

I'm not sure why. I tried switching double/single quotes, but that didn't work.

Bleakley
  • 183
  • 1
  • 5