1

This is how my txt document look like (an example);

asdf 
1234 
qwert 
56789 
zzzzz 
ccccc 

I want to add "STRING" in front each input, and a new line with "ENTER" after every input.

This is HOW I WANT it to look like;

STRING asdf 
ENTER 
STRING 1234 
ENTER 
STRING qwert 
ENTER 
...

I tried using the sed command in Linux, but my knowledge is limited.

I tried sed -e 's/$/ENTER/' -i pwdtest.txt but this dont write my "ENTER" keyword in a new line.

Im trying to make a rubber ducky script of a password list.

Please help me out solove this problem!

Ed Morton
  • 188,023
  • 17
  • 78
  • 185
alexxx033
  • 13
  • 3
  • 1
    Please show what you tried. Is it important that all input lines start with the keyword `STRING`? Can the script append the additional line `ENTER` after every input line whether it contains `STRING` or not? Please [edit] your question to add information or clarification, don't use comments for this purpose. – Bodo Dec 21 '21 at 23:38
  • Looks like CRLF endings again. Try `sed -i 's/\r$//;s/$/ENTER/' pwdtest.txt` – Wiktor Stribiżew Dec 22 '21 at 00:13
  • This just added the "ENTER" keyword at the end if each string. I need "ENTER" on a separate line after every input in the text file... – alexxx033 Dec 22 '21 at 00:40

1 Answers1

1

Just use awk:

$ awk '{print "STRING", $0 ORS "ENTER"}' file
STRING asdf
ENTER
STRING 1234
ENTER
STRING qwert
ENTER
STRING 56789
ENTER
STRING zzzzz
ENTER
STRING ccccc
ENTER
Ed Morton
  • 188,023
  • 17
  • 78
  • 185