-3

please advice

what need to change in the perl syntax in order to add new empty line after the last line?

example

    IP_INFO=12.23.2.1
    echo IP= |  perl  -pe "s/$/$IP_INFO/" 1>>file

.

more file

IP=12.23.2.1    <-- last line
yael
  • 2,433
  • 5
  • 31
  • 43

2 Answers2

1

try

echo IP= |  perl  -pe "s/$/$IP_INFO\n/" 1>>file
Laurentiu Roescu
  • 2,266
  • 17
  • 17
0

Why not just do it with another shell command?

IP_INFO=12.23.2.1
echo IP= |  perl  -pe "s/$/$IP_INFO/" 1>>file
echo >> file
pkhamre
  • 6,120
  • 3
  • 17
  • 27