Thanks..Actually i tried with substr and it was working..
Later i encountered an error and thought that is related to to the substr function. But looks like it caused by something else.
Thanks for the response !!
--- Post updated at 07:33 PM ---
Similar to that I am also trying an awk array and wanted to check if the array value match string "{5:{" , replace with 5: and assign it back to same array and print it.
But below code is not working its not able to replace the array value , instead its assigning whole command to msg_arr[i] and printing it
any solution for this?
as soon as i use "`" its giving me syntax error
Last edited by Don Cragun; 08-27-2019 at 09:49 PM..
Reason: Add CODE tags, again.
Dear Friends
I have text file as like below,
AAAAA|BHBHBH|VERYSMART
AAAAA| KKKKKK|GOOD
BBBBBB|JJJJJJJ|VERYGOOD
CCCCC|HJHJHJ|BETTER
CCCCC|UUUUU|GOOD
i need to split into seperate files based on column 1 like as below
AAAAA.TXT contains
--------------------
BHBHBH.VERYSMART... (4 Replies)
:confused: Hi UNIX gurus,
I am facing a typical problem while assigining while assigining output of awk to a variable.
I have a fixed length file say myinputfile.txt
When I allow the value/output of an awk to be redirected to a file, it works fine. i.e.
awk "/^.{232}$acctNum/ {... (8 Replies)
greetings all,
I am have a heck of a time trying to accomplish a very simple thing. I have an array of "shortname<spaces>id" created from a dscl output. I want to assign shortname=word1 and id=word2. I have tried
shortname=$(${textArray} | awk '{print $1}') - and get 'awk : cannot open... (3 Replies)
Dear All,
we have a command output which looks like :
Total 200 queues in 30000 Kbytes
and we're going to get "200" and "30000" for further process. currently, i'm using :
numA=echo $OUTPUT | awk '{print $2}'
numB=echo $OUTPUT | awk '{print $5}'
my question is : can I use just one... (4 Replies)
hi i want to find the size of a folder and assign it to a variable and then compare if it is greater than 1 gb.
i am doin this script, but it is throwing error....
#!/bin/ksh
cd . | du -s | size = awk '{print $1}'
if size >= 112000
then
echo size high
fi
ERROR : (4 Replies)
I launch 'netstat -a', if string 'ESTABLISHED' found, then VAR=1
#!/bin/bash
VAR=0;
netstat -a | awk '$6 ~ /ESTABLISHED/ {VAR=1}'
I cannot find the right syntax.
thanx guys! (3 Replies)
Hello,
I have searched but failed to find what exactly im looking for,
I need to eliminate first "." in a output so i can use something like the following
echo "./abc/20141127" | nawk '{gsub("^.","");print}'
what i want is to use gsub result later on, how could i achieve it?
Let say... (4 Replies)
I have the following script, and I want to assign the output ($10 and $5) from awk to N and L:
grdinfo data.grd | awk '{print $10,$5}'| read N L
output from gridinfo data.grd is: data.grd 50 100 41 82 -2796 6944 0.016 0.016 3001 2461. where N and L is suppose to be 3001 and 100. I use... (8 Replies)
Discussion started by: geomarine
8 Replies
LEARN ABOUT DEBIAN
mousex::nativetraits::str
MouseX::NativeTraits::Str(3pm) User Contributed Perl Documentation MouseX::NativeTraits::Str(3pm)NAME
MouseX::NativeTraits::Str - Helper trait for Str attributes
SYNOPSIS
package MyHomePage;
use Mouse;
has 'text' => (
traits => ['String'],
is => 'rw',
isa => 'Str',
default => q{},
handles => {
add_text => 'append',
replace_text => 'replace',
},
);
my $page = MyHomePage->new();
$page->add_text("foo"); # same as $page->text($page->text . "foo");
DESCRIPTION
This module provides a simple string attribute, to which mutating string operations can be applied more easily (no need to make an lvalue
attribute metaclass or use temporary variables). Additional methods are provided for completion.
PROVIDED METHODS
These methods are implemented in MouseX::NativeTraits::MethodProvider::Str. It is important to note that all those methods do in place
modification of the value stored in the attribute.
inc Increments the value stored in this slot using the magical string autoincrement operator. Note that Perl doesn't provide analogous
behavior in "--", so "dec" is not available.
append($string)
Append a string, like ".=".
prepend($string)
Prepend a string.
replace($pattern, $replacement)
Performs a regexp substitution ("s" in perlop). A code references will be accepted for the replacement, causing the regexp to be
modified with a single "e". "/smxi" can be applied using the "qr" operator.
replace($pattern, $replacement)
Performs a regexp substitution ("s" in perlop) with the "g" flag. A code references will be accepted for the replacement, causing the
regexp to be modified with a single "e". "/smxi" can be applied using the "qr" operator.
match($pattern)
Like "replace" but without the replacement. Provided mostly for completeness.
chop
"chop" in perlfunc
chomp
"chomp" in perlfunc
clear
Sets the string to the empty string (not the value passed to "default").
length
"length" in perlfunc
substr
"substr" in perlfunc. We go to some lengths to match the different functionality based on "substr"'s arity.
METHODS
meta
method_provider_class
helper_type
SEE ALSO
MouseX::NativeTraits
perl v5.14.2 2011-12-04 MouseX::NativeTraits::Str(3pm)