File: sdesc

package info (click to toggle)
saclib 2.2.8-6.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,872 kB
  • sloc: ansic: 40,932; csh: 1,190; asm: 541; awk: 320; sh: 246; perl: 116; makefile: 98; sed: 48
file content (57 lines) | stat: -rwxr-xr-x 1,417 bytes parent folder | download | duplicates (5)
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
#!/bin/tcsh

# USAGE:
#   sdesc <pattern> [<input file name> [<output file name> [<sc> [<ll>]]]]
#
# FUNCTION
#   Takes an an input file which consists of one or more blocks of the
#   following format:
#
#   <subject> <text>
#     <0 or more lines of additional text beginning with at least one blank>
#
#   The text part of these blocks is searched for the pattern. If it is
#   found, the block is displayed in the following format:
#
#   COLUMN  1         sc                                         ll
#           <subject> <text......................................>
#                     <0 or more lines of additional text........>
#
#   The default input file is "$saclib/doc/desc.doc", the default output file
#   is STDOUT, default values for sc and ll are 8 and 77.

if ($#argv < 1) then
  echo "USAGE:"
  echo "  sdesc <pattern> [<input file name> [<output file name> [<sc> [<ll>]]]]"
  perl $saclib/bin/svers.pl
  exit
endif
if ($#argv < 2) then
  set infile=$saclib/doc/desc.doc
else
  set infile=$2
endif
if ($#argv < 3) then
  set outfile=`tty`
else
  set outfile=$3
endif
if ($#argv < 4) then
  set sc=12
else
  set sc=$4
endif
if ($#argv < 5) then
  set ll=70
else
  set ll=$5
endif

awk -f $saclib/bin/b2l.awk $infile |\
grep -i "$1" |\
awk -f $saclib/bin/l2b.awk sc=$sc ll=$ll -

# The last line used to look like this:
# awk >$outfile -f $saclib/bin/l2b.awk sc=$sc ll=$ll -
# but I took it out