04-17-2008
Parsing problem
I need to parse a string which looks like
"xyx","sdfsdf","asf_asdf"
into
var1="xyx"
var2="sdfsdf"
var3="asf_asdf"
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm trying to parse the variables out of a comma delimited expression, but i'm having trouble with script:
num_var=1
while
do
a=`echo "a=7, b=8, c=9" | awk '{print $num_var}' | cut -d= -f2`
b=`echo $a | cut -d, -f1`
echo $b
num_var=`expr $num_var + 1`... (5 Replies)
Discussion started by: mike@freddiemac
5 Replies
2. Shell Programming and Scripting
I need help with a problem that I have not been able to figure out.
I have a file that is about 650K lines. Records are seperated by
blank lines, fields seperated by new lines. I was trying to make
a report that would add up 2 fields and associate them with a CP.
example output would be... (11 Replies)
Discussion started by: timj123
11 Replies
3. Shell Programming and Scripting
I need to separate out the contents in the string "xyz","1233","cm_asdfasdf" as xyz,1233,cm_asdfasdf
Can anyone help me on this?? (1 Reply)
Discussion started by: Sushir03
1 Replies
4. Shell Programming and Scripting
Hi,
i need to parse a string which looks like this
"xyz","1233","cm_asdfasdf" (2 Replies)
Discussion started by: Sushir03
2 Replies
5. Shell Programming and Scripting
Hi,
I have a textfile with several lines like this:
text num: USER text (num) num num
I need all these stuff. Problem is, how to get these stuff after ":".
USER is a username and all chars are possible, even whitespace. So I cant use cut. Any ideas? (3 Replies)
Discussion started by: mcW
3 Replies
6. Shell Programming and Scripting
Hi all,
I am having problems parsing the following file:
cat mylist
one,two,three
four
five,six
My goal is to get each number on a seperate line.
one
two
three
four
five
six
I tried this command:
sed -e 's/\,/^M/g' mylist (11 Replies)
Discussion started by: rob11g
11 Replies
7. Shell Programming and Scripting
Hello,
I have a similar problem so I continue this thread.
I have:
my_script_to_format_nicely_bdf.sh | grep "RawData" |tr -s ' '|cut -d' ' -f 4|tr -d '%'
So it supposed to return the percentage used of RawData FS:
80
(Want to use it in a alert script)
However I also have a RawData2 FS so... (17 Replies)
Discussion started by: drbiloukos
17 Replies
8. Shell Programming and Scripting
Heya
Tooltip: Parsing (getopts) for -u successfully sets mode=umnt, but case umnt is not executed,
instead it either executes/show help or regular mount screen.
I had copy pasted the structure of a getopts 'structure' from Man Page for getopts (posix Section 1) - The UNIX and Linux Forums... (1 Reply)
Discussion started by: sea
1 Replies
9. Shell Programming and Scripting
Hi,
I want to fetch a text.Clipping.
... (5 Replies)
Discussion started by: protocomm
5 Replies
10. Shell Programming and Scripting
Hello fellow unix geeks,
I am having a small dilemna trying to parse a log file I have. Below is a sample of what it will look like:
MY_TOKEN1(group) TOKEN(other)|SSID1
MY_TOKEN2(group, group2)|SSID2
What I need to do is only keep the MY_TOKEN pieces and where there are multiple... (7 Replies)
Discussion started by: dagamier
7 Replies
LEARN ABOUT DEBIAN
struct::compare
Compare(3pm) User Contributed Perl Documentation Compare(3pm)
NAME
Struct::Compare - Recursive diff for perl structures.
SYNOPSIS
use Struct::Compare;
my $is_different = compare($ref1, $ref2);
DESCRIPTION
Compares two values of any type and structure and returns true if they are the same. It does a deep comparison of the structures, so a hash
of a hash of a whatever will be compared correctly.
This is especially useful for writing unit tests for your modules!
PUBLIC FUNCTIONS
o $bool = compare($var1, $var2)
Recursively compares $var1 to $var2, returning false if either structure is different than the other at any point. If both are
undefined, it returns true as well, because that is considered equal.
BUGS
/NEEDED ENHANCEMENTS
o blessed references
compare currently does not deal with blessed references. I need to look into how to deal with this.
LICENSE
(The MIT License)
Copyright (c) 2001 Ryan Davis, Zen Spider Software
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AUTHOR
Ryan Davis <ryand-cmp@zenspider.com> Zen Spider Software <http://www.zenspider.com/ZSS/>
perl v5.12.4 2011-07-04 Compare(3pm)