There is an error when i am trying to use the shift command in this way:
($1 = -d, $2 = 123, $3 = -c etc etc)
for $arg in $@
do
case $arg in
"-d") shift; (so that the $2 will become the $arg now)
(and while it loop the 2nd time,)
... (1 Reply)
Hi Folks,
In shell scripting the maximum no. of command line parameters becomes 9(Am i right). If we want to get more than 9 parameters we use the shift command.
Even here there are two possibilities.
1. Without the use of variables - The arguments are lost and the lost no. is equal to the... (6 Replies)
I am running a program where in I have this command
which is giving error the shift: number is not correct.
can you please tell me how shift actually works?
the line which is giving error is-
set $PARAM; shift; shift; shift; shift; shift; shift; shift; shift
Is it related somewhere to... (2 Replies)
hi,
another perl question,
I don't understand the below
while (<FILE>) {
push @last5, $_; #add to the end
shift @last5 if @last5 > 5 ; #take from the beginning
}
can someone please explain to me how does
shift @last5 if @last5 > 5 is taking last 5 lines from... (5 Replies)
Hi,
I wrote one script, in between script needs to use 10th and 11th positional parameters, that time i used "shift". Here i am facing the below find problem,
./DataCount.sh: cannot shift
I tried
1) I have read man pages for shift
2) Before but * and **
3) Simple shift with out giving... (4 Replies)
Hey all, I need some assistance. I'm writing a script to eject tapes from a tape library, but the library is not a queued system and can only eject 15 tapes at a time.
I added paste -d : -s so that it goes through full_tapes and puts each media_id on one line separated by the :.
Now I'm... (2 Replies)
Hi,
Firstly, I did a search for this question both on this site and on the internet and have not been able to find a suitable answer that is not general in nature.
I have always been a Windows user. I use my girl friend's mac every now and then, but I always come back to windows. For a... (1 Reply)
Hello Expert
Can any one please explain what is the use of shift command in general terms:
set -- $(ls -t)
shift
rm -Rf $*
what is the use of shift command over here.
Thanks a lot for your help (2 Replies)
Hello everyone,
I am new to Perl and I am having some issues getting a script to work. I have to create a script that uses an array of 52 cards, "shuffles" the cards (using loops with the pop, shift, and push commands), and prints out the top five. This is not a randomizing of the array just a... (2 Replies)
#!/bin/bash
hostname=$1; shift
for hostname in $1
do
ping $hostname
done
I want to run the above script as hostname.sh yahoo.com google.com cnn.com. I want to shift each hostname to $1. How can do that with above code as currently it's not shifting. (5 Replies)
Discussion started by: scj2012
5 Replies
LEARN ABOUT DEBIAN
normalize::text::music_fields
Normalize::Text::Music_Fields(3pm) User Contributed Perl Documentation Normalize::Text::Music_Fields(3pm)NAME
Normalize::Text::Music_Fields - normalize names of people's and (musical) works.
SYNOPSIS
$name = $obj->Normalize::Text::Music_Fields::normalize_person($name);
$work = $obj->Normalize::Text::Music_Fields::normalize_piece($work);
# $obj should have methods `name_for_field_normalization', 'shorted_person'
DESCRIPTION
Databases of names and of works-per-name are taken from plain-text files (optionally in mail-header format). Names are stored in *.lst
files. Works are stored in .comp files named after the shortened name of the composer.
The directories of these files are looked in the environment variable "MUSIC_FIELDS_PATH" (if defined, split the same way as "PATH"), or in
"$ENV{HOME}/.music_fields", and "-" (and "-" is replaced by the directory named as the module file with .pm dropped). At runtime, one can
replace the list by calling function Normalize::Text::Music_Fields::set_path() with the list of directories as the argument.
(Since parsed files are cached, replacing the directory list should be done as early as possible.)
Files may be managed with utility subroutines provided with the module:
# Translate from one-per-line to mail-header format:
perl -wple "BEGIN {print q(# format = mail-header)} s/#s*normalizeds*$//; $_ = qq(Title: $_) unless /^s*(#|$)/; $_ = qq(
$_) if $p and not /^##/; $_ .= qq(
) unless $p = /^##/" Normalize::Text::Music_Fields-G_Gershwin.comp >Music_Fields-G_Gershwin.comp-mail
# (inverse transformation:) Dump pieces listed in mail-header format
perl -MNormalize::Text::Music_Fields -wle "print for Normalize::Text::Music_Fields::read_composer_file(shift, shift)" gershwin Music_Fields-G_Gershwin.comp-mail > o
# Normalize data in 1-line-per piece format
perl -MNormalize::Text::Music_Fields -wle "Normalize::Text::Music_Fields::prepare_tag_object_comp(shift)->Normalize::Text::Music_Fields::normalize_file_lines(shift)"
# Create a mail-header file from a semi-processed (with "bold" fields)
# mail-header file (with xml escapes, preceded by opus number)
perl -MNormalize::Text::Music_Fields -00wnle "BEGIN {$tag = Normalize::Text::Music_Fields::prepare_tag_object_comp(shift @ARGV); print q(# format = mail-header)} print Normalize::Text::Music_Fields::emit_as_mail_header($tag,$_, q(bold,xml,opus),$pre)" shostakovich o-xslt-better >Music_Fields-D_Shostakovich.comp-mail1
# Likewise, from work-per-line with opus-numbers:
perl -MNormalize::Text::Music_Fields -wnle "BEGIN {$tag = Normalize::Text::Music_Fields::prepare_tag_object_comp(shift @ARGV); print qq(# format = mail-header
)} print Normalize::Text::Music_Fields::emit_as_mail_header($tag,$_, q(opus), $pre)" schnittke o-schnittke-better >Music_Fields-A_Schnittke.comp-mail2
# A primitive tool for merging additional info into the database:
perl -MNormalize::Text::Music_Fields -wnle "BEGIN {$tag = Normalize::Text::Music_Fields::prepare_tag_object_comp(shift @ARGV); print qq(# format = mail-header
)} next unless s/^s*++s*//; print Normalize::Text::Music_Fields::merge_info($tag,$_, q(opus,xml), qr(^(58|70|76|116|118|119)($|-)))" brahms o-brahms-op-no1-xslt
# Minimal consistency check of persons database.
perl -MNormalize::Text::Music_Fields -wle "BEGIN{binmode $_, ':encoding(cp866)' for *STDIN, *STDOUT, *STDERR} print Normalize::Text::Music_Fields->check_persons"
# Minimal testing code:
perl -MNormalize::Text::Music_Fields -e Normalize::Text::Music_Fields::test_normalize_piece
It may be easier to type these examples if one uses "manage_M_N_F.pm", which exports the mentioned subroutines to the main namespace
(available in examples directory of a distribution of "MP3::Tag"). E.g., the last example becomes:
perl -Mmanage_M_N_F -e test_normalize_piece
perl v5.14.2 2009-05-08 Normalize::Text::Music_Fields(3pm)