Sed add forward-slash to beginning of line

Viewed 336

Want to add a forward slash to the beginning of each line in a file. Having trouble escaping the character.

Input

// input.txt
hello
world
foo
bar

Expected Output

/hello
/world
/foo
/bar

Command Tried

cat input.txt | sed 's/^/\/\\/'

Output of Command Tried

/\hello
/\world
/\foo
/\bar

Any insights is appreciated

1 Answers
$ cat input.txt | sed 's/^/\//'
/hello
/world
/foo
/bar
Related