V
vjp2
is that x or *???
perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37} $_.="\n"'
< %1 >%1
perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37} $_.="\n"'
< %1 >%1
is that x or *???
perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37} $_.="\n"'
< %1 >%1
is that x or *???
perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37}
$_.="\n"' < %1 >%1
is that x or *???
{$_.="-" x 37}
First thanks for all the help and for putting up with me.
Here's how I think this is supposed to work:
If the line number mod 4 is two, add a spacer of hyphens,
Every fourth line should be spaced by equal signs
the thing should be double spaced.
(I am using fold, but it would be cool if perl did justification)
I tried moving it to my Unix Shell ISP. Here's what I got
Both DOS and Bash do this "command not found".
I don't understand, does perl try to act like a bat/cmd/sh file?
perl -pe "if ($.%4==2) {$_.='\n'.`-` x 37} elsif ($.%4==0) {$_.='\n'.`=`
x 37} else {$_.=`\n`}" junk.tmp
-bash: : command not found
-bash: -: command not found
Many thanks. Did that. Only message I get now is three "command not found"
What is
$_.=
? Concatenate what follows to a new line immediately after the current?
Is it possible the equal sign is redundant?
Many thanks. I made a bit of progress. At least it doesn't bomb!
Using DOS GNU v4. I had to use " " to enclose the expression.
And change the internal "" to `` not ''.
But I'm getting a no-op. Is it possible it resets $. for every line?
Michele said:For "internal" strings you can use alternate delimiters.
(0) Ok, back up to the beginning (thanks,sorry).
tried perl -pe 'print "goat \n"' on Unix and perl -pe "print 'goat \n'" on DOS
both cases it stood there waiting for further input
This is what I ran on Unix
perl -pe 'if ($.%4==2) {$_ .= qq(\n).q(-) x 37} elsif ($.%4==0) {$_ .= qq(\n).q(=) x 37} else {$_ .= qq(\n)}' junk.tmp
and what I got was "command not found" three times.
In <[email protected]> by Ian Wilson <[email protected]> on Thu, 08 Feb 2007 14:11:04 +0000 we perused:
*+-Because you used the -p option and didn't supply a filename?
Wait! How many filenames? In & out or only in?
What if out should be the terminal?
Michele Dondi said:: perl -pe 'if ($.%4==2){$_.="-" x 37} elseif {$.%4==0) {$_.="=" x 37} $_.="\n"'
^
^
Apart that the underlined curly above should
really be a paren, and that "elseif" should be spelled "elsif".
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.