![]() |
![]() ![]()
Experimental Physics and
| ||||||||||||||
|
The script below sorts record definition blocks, but not the
fields within a record. The "record" header must begin
in column 1 and the record's closing bracket must be the last
non-whitespace character on the line.
#!/usr/local/bin/perl
# File: recordSort # Purpose: Sort an EPICS .db file by record name. # Usage: recordSort <file> $name = '!'; $block = ''; while( <>) { if ( /^record.*"(.*)"/) { $name = $1; $block = $_; } else { $block .= $_; if ( /\}\s*$/) { $block{ $name} = $block; undef $block; } } } foreach $name ( sort keys %block) { print $block{ $name};} # EOF
| ||||||||||||||
ANJ, 31 Jan 2014 |
![]() · Download · Search · IRMIS · Talk · Documents · Links · Licensing · |