summaryrefslogtreecommitdiff
path: root/x2p/s2p.man
blob: 1374dff928bbed2663289187745f19d703a7f89e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
.rn '' }`
''' $RCSfile: s2p.man,v $$Revision: 4.1 $$Date: 92/08/07 18:29:24 $
''' 
''' $Log:	s2p.man,v $
''' Revision 4.1  92/08/07  18:29:24  lwall
''' 
''' Revision 4.0.1.1  91/06/07  12:19:57  lwall
''' patch4: s2p now handles embedded newlines better and optimizes common idioms
''' 
''' Revision 4.0  91/03/20  01:58:07  lwall
''' 4.0 baseline.
''' 
''' Revision 3.0  89/10/18  15:35:09  lwall
''' 3.0 baseline
''' 
''' Revision 2.0  88/06/05  00:15:59  root
''' Baseline version 2.0.
''' 
''' 
.de Sh
.br
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp
.if t .sp .5v
.if n .sp
..
.de Ip
.br
.ie \\n.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
'''
'''     Set up \*(-- to give an unbreakable dash;
'''     string Tr holds user defined translation string.
'''     Bell System Logo is used as a dummy character.
'''
.tr \(*W-|\(bv\*(Tr
.ie n \{\
.ds -- \(*W-
.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
.ds L" ""
.ds R" ""
.ds L' '
.ds R' '
'br\}
.el\{\
.ds -- \(em\|
.tr \*(Tr
.ds L" ``
.ds R" ''
.ds L' `
.ds R' '
'br\}
.TH S2P 1 NEW
.SH NAME
s2p - Sed to Perl translator
.SH SYNOPSIS
.B s2p [options] filename
.SH DESCRIPTION
.I S2p
takes a sed script specified on the command line (or from standard input)
and produces a comparable
.I perl
script on the standard output.
.Sh "Options"
Options include:
.TP 5
.B \-D<number>
sets debugging flags.
.TP 5
.B \-n
specifies that this sed script was always invoked with a sed -n.
Otherwise a switch parser is prepended to the front of the script.
.TP 5
.B \-p
specifies that this sed script was never invoked with a sed -n.
Otherwise a switch parser is prepended to the front of the script.
.Sh "Considerations"
The perl script produced looks very sed-ish, and there may very well be
better ways to express what you want to do in perl.
For instance, s2p does not make any use of the split operator, but you might
want to.
.PP
The perl script you end up with may be either faster or slower than the original
sed script.
If you're only interested in speed you'll just have to try it both ways.
Of course, if you want to do something sed doesn't do, you have no choice.
It's often possible to speed up the perl script by various methods, such
as deleting all references to $\e and chop.
.SH ENVIRONMENT
S2p uses no environment variables.
.SH AUTHOR
Larry Wall <lwall@jpl-devvax.Jpl.Nasa.Gov>
.SH FILES
.SH SEE ALSO
perl	The perl compiler/interpreter
.br
a2p	awk to perl translator
.SH DIAGNOSTICS
.SH BUGS
.rn }` ''