Save as formatter.pl, run as perl formatter.pl [file1 file2 ...]
Code:
#!/usr/bin/perl
use strict;
use warnings;
#
# An ordered list of item labels.
my @ordered_labels = (
'insert_job',
'job_type',
'box_name',
'command',
'machine',
'owner',
'permission',
'date_conditions',
'std_out_file',
'std_err_file',
'alarm_if_fail',
'group',
'application',
'send_notification',
'notification_msg',
'notification_emailaddress',);
#
# Buffer db for all values on each group.
my %db;
display_header();
#
# Parse and collect values.
while(<>) {
#
# Inside a group
if(/^insert_job/../^\n/){
if(/^insert_job/) {
#
# First line has two pairs and value does not have
# spaces
while(/(\w+):\s(\w+)/g) {
$db{$1} = $2;
}
}
else {
#
# Parse only one pair that may contain all kind
# of characters as value, including spaces and quotes.
/(\w+):\s(.*$)/ and $db{$1} = $2;
}
#
# Display the data gathered and clear db for next time.
if(/^\n/) {
display_body();
%db = ();
}
}
}
# Display any data still in the db buffer.
display_body() if %db;
sub display_header {
print "JOB_NAME;JOB_TYPE;";
for(@ordered_labels[2..$#ordered_labels]) {
print "$_;";
}
print "\n";
}
sub display_body {
for my $i (@ordered_labels) {
if (defined $db{$i}){
$db{$i} =~ s/"//g;
print "$db{$i};";
}
else {
print " ;";
}
}
print "\n";
}
A program named /usr/bin/aa.sh, two parameters: 11, 22. after start it, the row in `ps -ef` is almost like the following:
root 12198 10278 0.0 Nov 25 pts/3 0:00.23 /usr/bin/aa.sh 11 22
but I want to change "/usr/bin/aa.sh 11 22" to one rule string, such as: "AA_11_22", how to... (1 Reply)
Hello:
I am using csh, and am a complete noob when it comes to shell scripting.
I want the following:
1) Ignore case when doing auto-complete.
2) If there are multiple matches (example: I have files abc.txt abc.txt.1, abc.txt.2 and type abc<tab>), count the number of matches.
If... (1 Reply)
Hi.
I hope someone can help me. I have e very special question.
I have a Lunix server and I have installed Webmin on it. This way, I can create a login for an other user and give him restricted access to some custom commands I set up.
One of the commands i would like to setup, is for him to... (9 Replies)
I had started writting my own custom libraries on an AIX 4.2. Before finishing, I wanted to do a very simple test. So I wrote the followings:
test.sh
#!/bin/ksh
. testlib.sh
ZZ=testz "aa" "bb"
echo "$ZZ"
exit 0
testlib.sh
testz () {
return "$1$2"
}
When I ran my test.sh, I got an... (2 Replies)
I have an rsync command that I want to create a variable where user can change to customize the parameters.
complete rsync command to run:
$RSYNC -e 'ssh -ax -o ClearAllForwardings=yes' --log-file=$LOG_FILE --delete -avzcr -u --update $SRC_DIR $USER@$TRG_SRV:$TRG_DIR >> $LOG_FILE
What I... (4 Replies)
hi
I am trying to make my own commands in my linux.I thought a command for changing directories will be easy.
I made a simple file amd made the entries
#!/bin/bash
cd /opt/mydir
I then made the file executable and then moved it to /usr/bin.
But when i type the script name nothing... (2 Replies)
Hi All :)
i would like to know if i can customize the WWN of the new VFC (NPIV).
Or, if i must move the LPAR on another server with another FCS, i have to change the zoning??
Thanks in advance.
Mario
---------- Post updated 09-21-12 at 02:51 AM ---------- Previous update was 09-20-12 at... (1 Reply)
I have a jump off server, which grants SSH access to a few other servers.
I would like to create a custom shell which can be assigned to specific user accounts which runs a menu script upon login, where they can select which server they want to jump too, however should they hit ctrl-c or any... (1 Reply)
i have data that can look like this:
echo "Master_Item_Service_is_down=0_njava_lang_NoClassDefFoundError=0_njava_lang_OutOfMemoryError=1_nemxCommonAppInitialization__Error_while_initializing=0_nINFO__Stopping_Coyote_HTTP_1_1_on_http_8080=7_nThe_file_or_directory_is_corrupted_and_unreadable=0_n" ... (7 Replies)
Discussion started by: SkySmart
7 Replies
LEARN ABOUT DEBIAN
speexenc
SPEEXENC(1) User Commands SPEEXENC(1)NAME
speexenc - The reference implementation speex encoder.
SYNOPSIS
speexenc [options] input_file output_file
DESCRIPTION
Encodes input_file using Speex. It can read the WAV or raw files.
input_file can be:
filename.wav
wav file
filename.*
Raw PCM file (any extension other than .wav)
- stdin
output_file can be:
filename.spx
Speex file
- stdout
OPTIONS -n, --narrowband
Narrowband (8 kHz) input file
-w, --wideband
Wideband (16 kHz) input file
-u, --ultra-wideband "Ultra-wideband" (32 kHz) input file
--quality n
Encoding quality (0-10), default 8
--bitrate n
Encoding bit-rate (use bit-rate n or lower)
--vbr Enable variable bit-rate (VBR)
--abr rate
Enable average bit-rate (ABR) at rate bps
--vad Enable voice activity detection (VAD)
--dtx Enable file-based discontinuous transmission (DTX)
--comp n
Set encoding complexity (0-10), default 3
--nframes n
Number of frames per Ogg packet (1-10), default 1
--comment
Add the given string as an extra comment. This may be used multiple times
--author
Author of this track
--title
Title for this track
-h, --help
This help
-v, --version
Version information
-V Verbose mode (show bit-rate)
Raw input options:
--rate n
Sampling rate for raw input
--stereo
Consider raw input as stereo
--le Raw input is little-endian
--be Raw input is big-endian
--8bit Raw input is 8-bit unsigned
--16bit
Raw input is 16-bit signed
Default raw PCM input is 16-bit, little-endian, mono
More information is available from the Speex site: http://www.speex.org
Please report bugs to the mailing list `speex-dev@xiph.org'.
COPYRIGHT
Copyright (C) 2002 Jean-Marc Valin
speexenc version 1.1 September 2003 SPEEXENC(1)