kulua has asked for the wisdom of the Perl Monks concerning the following question:
I have a input.txt file which contains
module abc(
rist_top_tck,
rist_top_tdi,
rist_top_tdo,
The output file should be
module abc(
.rist_top_tck(rist_top_tck),
.rist_top_tdi(rist_top_tdi),
.rist_top_tdo(rist_top_tdo));
I search in the internet for perl code . Which repeat each line twice .
repeats=2 while read line; do yes $line|head --lines=$repeats; done < infile > o +utfile
But I I want the above pattern. What should be the modified code. I am new to perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: To repeat each word in a line
by kcott (Archbishop) on May 23, 2021 at 14:29 UTC | |
|
Re: To repeat each word in a line
by hippo (Archbishop) on May 23, 2021 at 09:18 UTC | |
by kulua (Initiate) on May 23, 2021 at 10:35 UTC | |
by hippo (Archbishop) on May 23, 2021 at 13:38 UTC | |
by 1nickt (Canon) on May 23, 2021 at 11:46 UTC | |
|
Re: To repeat each word in a line
by AnomalousMonk (Archbishop) on May 23, 2021 at 06:57 UTC | |
|
Re: To repeat each word in a line
by NetWallah (Canon) on May 23, 2021 at 05:32 UTC | |
by kulua (Initiate) on May 23, 2021 at 06:39 UTC |