Sponsored Content
Full Discussion: How to parse a line?
Top Forums Shell Programming and Scripting How to parse a line? Post 93832 by edefoe on Thursday 22nd of December 2005 11:48:36 AM
Old 12-22-2005
How to parse a line?

I'm currenting trying to parse the out put of the following command.

iostat -xtc -r |grep cmdk0

which produces the output

cmdk0,0.2,0.0,1.2,0.0,0.0,0.0,39.7,0,0,0,0,0,0,0,99

I'm then trying to get the data to look like this:
rw=0.2
ws=0.0
krs=1.2
kws=0.0
wait=0.0
actv=0.0
svct=39.7
%w=0
%b=0
tin=0
tout=0
us=0
sy=0
wt=0
id=99

Any thoughts on how to do this would be great.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

please help to parse the line

cp4 0 0 170.217.86.10.1421 170.217.86.8.53308 ESTABLISHED tcp4 0 0 170.217.86.10.1421 170.217.86.8.62948 ESTABLISHED tcp4 0 0 170.217.86.10.1421 170.217.86.8.62949 ESTABLISHED tcp4 0 0 170.217.86.10.1421 ... (1 Reply)
Discussion started by: ajaya
1 Replies

2. Shell Programming and Scripting

please help to parse the line

cp4 0 0 170.217.86.10.1421 170.217.86.8.53308 ESTABLISHED tcp4 0 0 170.217.86.10.1421 170.217.86.8.62948 ESTABLISHED tcp4 0 0 170.217.86.10.1421 170.217.86.8.62949 ESTABLISHED tcp4 0 0 170.217.86.10.1421 ... (1 Reply)
Discussion started by: ajaya
1 Replies

3. Shell Programming and Scripting

SED help (remove line::parse again::add line)

Aloha! I have just over 1k of users that have permissions that they shouldn't under our system. I need to parse a provided list of usernames, check their permissions file, and strip the permissions that they are not allowed to have. If upon the permissions strip they are left with no permissions,... (6 Replies)
Discussion started by: Malumake
6 Replies

4. UNIX for Advanced & Expert Users

how do you parse 1 line at a time of file1 ie. line(n) each line into new file

File 1 <html>ta da....unique file name I want to give file=>343...</html> <html>da ta 234 </html> <html>pa da 542 </html> and so on... File 2 343 234 542 and so on, each line in File 1 one also corresponds with each line in File 2 I have tried several grep, sed, while .. read, do,... (4 Replies)
Discussion started by: web_developer
4 Replies

5. Shell Programming and Scripting

To parse the line

Hi, I have a line QMNAME(qmgrname) STATUS(RUNNING) Can u jus tell me how to only get the status field ? And also the value of the status whether it is running or not running. -- Thanks (2 Replies)
Discussion started by: julie_s
2 Replies

6. Shell Programming and Scripting

Parse a line by a space

I am trying to show each word on a separate line, but read in all the words on one command line. Below is the code I have right now: read name MyString=$name name2=" " echo $MyString | awk -v ORS="" '{ gsub(/./,"&\n") ; print }' | \ while read char do if then ... (8 Replies)
Discussion started by: tvb2727
8 Replies

7. Shell Programming and Scripting

Help with cut and parse the line

I have log file which contains 1000s of lines something like this. INFO |2010-08-29 14:23:37,078|SERIAL_ID=1283109816352|ST=2010-08-2914:23:36|DP_DEVICE=11.22.33.44:4420|TYPE=TransactionLo g|LOG_LEVEL=6|CLASS=Superior... (7 Replies)
Discussion started by: baraghun
7 Replies

8. Shell Programming and Scripting

Parse XML line

Hi I am having an xml file with lines like these <d name="T2tt_350_100" title="T2tt_012j_350_100_428p4_pPF_PU" add="1" color="4" ls="1" lw="2" normf="1" xsection="0.070152" EqLumi="94651.6"... (2 Replies)
Discussion started by: Alkass
2 Replies

9. Shell Programming and Scripting

Parse the next line

If you have a file like this Mike Student:1:4 Boy Student:3:4 Girl :master Then Output is: Mike Student:1:4 Boy Student:3:4 Girl :master (7 Replies)
Discussion started by: invinzin21
7 Replies

10. Shell Programming and Scripting

Ksh: Read line parse characters into variable and remove the line if the date is older than 50 days

I have a test file with the following format, It contains the username_date when the user was locked from the database. $ cat lockedusers.txt TEST1_21062016 TEST2_02122015 TEST3_01032016 TEST4_01042016 I'm writing a ksh script and faced with this difficult scenario for my... (11 Replies)
Discussion started by: humble_learner
11 Replies
MP3::Tag::ParseData(3pm)				User Contributed Perl Documentation				  MP3::Tag::ParseData(3pm)

NAME
MP3::Tag::ParseData - Module for parsing arbitrary data associated with music files. SYNOPSIS
# parses the file name according to one of the patterns: $mp3->config('parse_data', ['i', '%f', '%t - %n - %a.%e', '%t - %y.%e']); $title = $mp3->title; see MP3::Tag DESCRIPTION
MP3::Tag::ParseData is designed to be called from the MP3::Tag module. Each option of configuration item "parse_data" should be of the form "[$flag, $string, $pattern1, ...]". For each of the option, patterns of the option are matched agains the $string of the option, until one of them succeeds. The information obtained from later options takes precedence over the information obtained from earlier ones. The meaning of the patterns is the same as for parse() or parse_rex() methods of "MP3::Tag". Since the default for "parse_data" is empty, by default this handler has no effect. $flag is split into 1-character-long flags (unknown flags are ignored): "i" the string-to-parse is interpolated first; "f" the string-to-parse is interpreted as the name of the file to read; "F" added to "f", makes it non-fatal if the file does not exist; "B" the file should be read in "binary" mode; "n" the string-to-parse is interpreted as collection of lines, one per track; "l" the string-to-parse is interpreted as collection of lines, and the first matched is chosen; "I" the resulting string is interpolated before parsing. "b" Do not strip the leading and trailing blanks. (With output to file, the output is performed in binary mode too.) "R" the patterns are considered as regular expressions. "m" one of the patterns must match. "o", "O", "D" With "o" or "O" interpret the pattern as a name of file to output parse-data to. With "O" the name of output file is interpolated. When "D" is present, intermediate directories are created. "z" Do not ignore a field even if the result is a 0-length string. Unless "b" option is given, the resulting values have starting and trailing whitespace trimmed. (Actually, split()ing into lines is done using the configuration item "parse_split"; it defaults to " ".) If the configuration item "parse_data" has multiple options, the $strings which are interpolated will use information set by preceding options; similarly, any interolated option may use information obtained by other handlers - even if these handers are later in the pecking order than "MP3::Tag::ParseData" (which by default is the first handler). For example, with ['i', '%t' => '%t (%y)'], ['i', '%t' => '%t - %c'] and a local CDDB file which identifies title to 'Merry old - another interpretation(1905)', the first field will interpolate '%t' into this title, then will split it into the year and the rest. The second field will split the rest into a title-proper and comment. Note that one can use fields of the form ['mz', 'This is a forced title' => '%t'] to force particular values for parts of the MP3 tag. The usual methods "artist", "title", "album", "comment", "year", "track", "year" can be used to access the results of the parse. It is possible to set individual id3v2 frames; use %{TIT1} or some such. Setting to an empty string deletes the frame if config parameter "id3v2_frame_empty_ok" is false (the default value). Setting ID3v2 frames uses the same translation rules as select_id3v2_frame_by_descr(). SEE ALSO The flags "i f F B l m I b" are identical to flags of the method interpolate_with_flags() of MP3::Tag (see "interpolate_with_flags" in MP3::Tag). Essentially, the other flags ("R m o O D z") are applied to the result of calling the latter method. perl v5.14.2 2009-12-30 MP3::Tag::ParseData(3pm)
All times are GMT -4. The time now is 03:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy