Hi,
I have to split a line of the form
1232423#asdf#124324#54534#dcfg#wert#rrftt#4567
into an array in perl. I am using
@fields;
@fields=split('#',$line);
if($fields eq "1")
But this is not working. By using the syntax, the statements in "if" are never executed. Please help.... (9 Replies)
how can I find cpu usage memory usage swap usage and
I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times
my final destination is monitor process
logical volume usage above X % and number of Logical voluage above
can I not to... (3 Replies)
Hi all,
Can you please tell me the command, with which one can know the amount of space a specific directory has used.
df -k . ---> Displays, the amount of space allocated, and used for a directory.
du -k <dir name> - gives me the memory used of all the files inside <dir>
But i... (2 Replies)
i have two files as shown below
t1.txt:
argument1
argu2
argu37
t2.txt:
22
33
44
i want o/p as
argument1 22
argu2 33
argu37 44
i am trying to merge two file under perl script using following
system("paste t1.txt t2.txt | awk... (3 Replies)
Hi,
I have an array with following data. First field shows the owner and second is unique name. Now i have to pic the latest value with respect to the date in case of duplicate.
like "def" is from two owners "rahul/vineet", now i want the latest from the two and the owner name also for all the... (9 Replies)
Hi I have some doubts with below perl script sub program .
In the below code what are below lines do ?
1. ($user, $server, $os, $version, $ref_path, $ref_line, $ref_ftp) = @_;
2. if ( -e "/usr/kerberos/bin/krsh" )
3. $$ref_path = "/usr/kerberos/bin" unless ($$ref_path);why we are... (1 Reply)
Hi,
I have a shell script, In which i have variable "var1" and some perl command inside shell script.
export var1='coep -n rst-a2p-hinje.vci.all.com -c'
perl -pi -e 's/^/coep -n rst-a2p-hinje.vci.all.com -c /' command.txt
currently I am adding value of var1 in command.txt file by... (2 Replies)
I'm not sure why I'm having so much trouble with this.
I think I'm really not understanding how this works.
I'm trying to store a regex in a variable for use later in a script.
Can someone tell me why this doesn't match???
#!/usr/bin/perl
#
#
#
$ticket=1212;
my $rx_ticket =... (1 Reply)
Discussion started by: timj123
1 Replies
LEARN ABOUT CENTOS
split
split(n) Tcl Built-In Commands split(n)
__________________________________________________________________________________________________________________________________________________NAME
split - Split a string into a proper Tcl list
SYNOPSIS
split string ?splitChars?
_________________________________________________________________DESCRIPTION
Returns a list created by splitting string at each character that is in the splitChars argument. Each element of the result list will con-
sist of the characters from string that lie between instances of the characters in splitChars. Empty list elements will be generated if
string contains adjacent characters in splitChars, or if the first or last character of string is in splitChars. If splitChars is an empty
string then each character of string becomes a separate element of the result list. SplitChars defaults to the standard white-space char-
acters.
EXAMPLES
Divide up a USENET group name into its hierarchical components:
split "comp.lang.tcl.announce" .
-> comp lang tcl announce
See how the split command splits on every character in splitChars, which can result in information loss if you are not careful:
split "alpha beta gamma" "temp"
-> al {ha b} {} {a ga} {} a
Extract the list words from a string that is not a well-formed list:
split "Example with {unbalanced brace character"
-> Example with {unbalanced brace character
Split a string into its constituent characters
split "Hello world" {}
-> H e l l o { } w o r l d
PARSING RECORD-ORIENTED FILES
Parse a Unix /etc/passwd file, which consists of one entry per line, with each line consisting of a colon-separated list of fields:
## Read the file
set fid [open /etc/passwd]
set content [read $fid]
close $fid
## Split into records on newlines
set records [split $content "
"]
## Iterate over the records
foreach rec $records {
## Split into fields on colons
set fields [split $rec ":"]
## Assign fields to variables and print some out...
lassign $fields
userName password uid grp longName homeDir shell
puts "$longName uses [file tail $shell] for a login shell"
}
SEE ALSO
join(n), list(n), string(n)
KEYWORDS
list, split, string
Tcl split(n)