Replacing irregular number of slashes (/) using sed

I have a file with a number of slashes (/) and the number is not unique. The Part of data file looks like:

input.txt

30
///
10
40
23
44
//
////
31
/
54
/

Anybody please suggest me how to replace any number of slashes (/) with an undefined value (9999). I look for the output as

output.txt

30
9999
10
40
23
44
9999
9999
31
9999
54
9999


Source: unix

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.