Im currently working on a project,but im unable append port to Ip list.Example below.
235.67.89.65
23.66.34.90
12.34.98.45
12.45.77.100
I WANT A BASH SCRIPT either in Awk,sed or grep to get the following result
235.67.89.65:8080
23.66.34.90:8080
12.34.98.45:8080
12.45.77.100:8080
Kindly help me out with a working command.
CodePudding user response:
Using sed
$ sed 's/$/:8080/' input_file
235.67.89.65:8080
23.66.34.90:8080
12.34.98.45:8080
12.45.77.100:8080
CodePudding user response:
You might GNU AWK
for this as follows, let file.txt
content be
235.67.89.65
23.66.34.90
12.34.98.45
12.45.77.100
then
awk '{print $0 ":8080"}' file.txt
output
235.67.89.65:8080
23.66.34.90:8080
12.34.98.45:8080
12.45.77.100:8080
Explanation: for each line do print
whole line ($0
) concatenated with :8080
.
(tested in gawk 4.2.1)