Sponsored Content
Full Discussion: Parsing problem
Top Forums Shell Programming and Scripting Parsing problem Post 302186733 by Sushir03 on Friday 18th of April 2008 02:19:21 AM
Old 04-18-2008
Parsing

I read the line "xyx","asdfsd","qweerqw_adfad"

from a input text file, i need to separate out the data from this single string into separate variables like

"xyx"
"asdfsd"
"qweerqw_adfad"
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

parsing problem with script

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

awk parsing problem

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

Parsing problem

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

Parsing problem

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

Parsing textfile problem with cut

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

Parsing Problem

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

Parsing problem

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

Problem parsing args

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

Problem parsing

Hi, I want to fetch a text.Clipping. ... (5 Replies)
Discussion started by: protocomm
5 Replies

10. Shell Programming and Scripting

awk parsing problem

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
doctools::tcl::parse(n) 					Documentation tools					   doctools::tcl::parse(n)

__________________________________________________________________________________________________________________________________________________

NAME
doctools::tcl::parse - Processing text in 'subst -novariables' format SYNOPSIS
package require Tcl 8.4 package require snit package require fileutil package require logger package require struct::list package require struct::stack package require struct::set package require treeql ::doctools::tcl::parse text tree text ?root? ::doctools::tcl::parse file tree path ?root? _________________________________________________________________ DESCRIPTION
This package provides commands for parsing text with embedded Tcl commands as accepted by the Tcl builtin command subst -novariables. The result of the parsing is an abstract syntax tree. This is an internal package of doctools, for use by the higher level parsers processing the docidx, doctoc, and doctools markup languages. API
::doctools::tcl::parse text tree text ?root? The command takes the text and parses it under the assumption that it contains a string acceptable to the Tcl builtin command subst -novariables. Errors are thrown otherwise during the parsing. The format used for these errors in described in section Error format. The command returns the empty string as it result. The actual result of the parsing is entered into the tree structure tree, under the node root. If root is not specified the root of tree is used. The tree has to exist and be the command of a tree object which supports the same methods as trees created by the package struct::tree. In case of errors tree will be left in an undefined state. ::doctools::tcl::parse file tree path ?root? The same as text, except that the text to parse is read from the file specified by path. ERROR FORMAT
When the parser encounters a problem in the input it will throw an error using the format described here. [1] The message will contain the reason for the problem (unexpected character or end of input in input), the character in question, if any, and the line and column the problem was found at, in a human readable form. This part is not documented further as its format may change as we see fit. It is intended for human consumption, not machine. [2] The error code however will contain a machine-readable representation of the problem, in the form of a 5-element list containing, in the order listed below [1] the constant string doctools::tcl::parse [2] the cause of the problem, one of char Unexpected character in input eof Unexpected end of the input [3] The location of the problem as offset from the beginning of the input, counted in characters. Note: Line markers count as one character. [4] The line the problem was found on (counted from 1 (one)), [5] The column the problem was found at (counted from 0 (zero)) TREE STRUCTURE
After successfully parsing a string the generated tree will have the following structure: [1] In the following items the word 'root' refers to the node which was specified as the root of the tree when invoking either text or file. This may be the actual root of the tree. [2] All the following items further ignore the possibility of pre-existing attributes in the pre-existing nodes. If attributes exists with the same names as the attributes used by the parser the pre-existing values are written over. Attributes with names not clash- ing with the parser's attributes are not touched. [3] The root node has no attributes. [4] All other nodes have the attributes type The value is a string from the set { Command , Text , Word } range The value is either empty or a 2-element list containing integer numbers. The numbers are the offsets of the first and last character in the input text, of the token described by the node,. line The value is an integer, it describes the line in the input the token described by the node ends on. Lines are counted from 1 (one). col The value is an integer, it describes the column in the line in the input the token described by the node ends on. Columns are counted from 0 (zero). [5] The children of the root, if any, are of type Command and Text, in semi-alternation. This means: After a Text node a Command node has to follow, and anything can follow a Command node, a Text or other Command node. [6] The children of a Command node, if any, are of type Command, and Text, and Word, they describe the arguments of the command. [7] The children of a Word node, if any, are of type Command, Text, in semi-alternation. This means: After a Text node a Command node has to follow, and anything can follow a Command node, a Text or other Command node. [8] A Word node without children represents the empty string. [9] All Text nodes are leaves of the tree. [10] All leaves of the tree are either Text or Command nodes. Word nodes cannot be leaves. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category doctools of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
Tcl syntax, command, doctools, parser, subst, word CATEGORY
Documentation tools COPYRIGHT
Copyright (c) 2009 Andreas Kupries <andreas_kupries@users.sourceforge.net> doctools2base 1 doctools::tcl::parse(n)
All times are GMT -4. The time now is 08:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy