Sponsored Content
Full Discussion: how to parse this string
Top Forums Shell Programming and Scripting how to parse this string Post 302180855 by pupp on Tuesday 1st of April 2008 11:17:29 AM
Old 04-01-2008
set your delimiter to / and print over the number of fields.
maybe something like:

echo $PATH | awk -F/ '{print $4, $6, $11}'
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

parse a string variable

Hello all, need a little help. I have an input variable such as ARGV which equals something like /use/home/name/script/test.dat I need to be able to get just the "test.dat" (i.e. the file name) at the end of the directory and the directory can be anything and any length. To put it another... (3 Replies)
Discussion started by: methos
3 Replies

2. Shell Programming and Scripting

String parse question

I have a string of data that looks like this: private.enterprises.954.1.1.1.1.1.2618 \(OctetString\): U private.enterprises.954.1.1.1.1.2.2618 \(OctetString\): 2618 I am trying to parse the string to only return the values after the ":". Ex from above "U" and "2618". Any suggestions? (5 Replies)
Discussion started by: mnreferee
5 Replies

3. Shell Programming and Scripting

Parse String Using Sed

Hi, I am wondering if there's a simpler way to extract the second occurrence of a word enclosed in that matches my search criteria. Sample Input is as follows: Error installing feature - com.er.nms.cif.ist.NoMatchingUpgra Error installing feature -... (4 Replies)
Discussion started by: racbern
4 Replies

4. UNIX for Dummies Questions & Answers

parse string with awk

Hi Guys, I spend half a day getting this to work with no luck, perhaps you guys can help.. I have a string from a file looking like this: module::name=test::type=generic_data::exec=snmpget.......::desc=A Little Test::interval=300 what I would like to split it, so I get a value for each... (3 Replies)
Discussion started by: hyber
3 Replies

5. Shell Programming and Scripting

How to parse a string into variables

I'm working in korn shell and have a variable which contains a string like: aa_yyyymmdd_bbb_ccc_ddd.abc. I want to treat the _ and . as delimiters and parse the string so I end up with 6 values in variables that I can manipulate. My original plan was to use var1=`echo $sting1 | cut -c1-c2` but... (9 Replies)
Discussion started by: aquimby
9 Replies

6. Shell Programming and Scripting

Parse string

Hi, I need to parse a string, check if there are periods and strip the string. For example i have the following domains and subdomains: mydomain.com, dev.mydomain.com I need to strip all periods so i have a string without periods or domain extensions: mydomain, devmydomain. I use this for... (12 Replies)
Discussion started by: ktm
12 Replies

7. Shell Programming and Scripting

Search string and parse

Input file 0792 to 2450 iadmssql7: Copy: CNJ R1: Replication volumes: Replication set: RSet 1 Replication size: 200.00GB SAN Info: 200.00GB DGC VRAID CX4-960 LUN 17 (17) RPA Port WWN Ctrl ... (0 Replies)
Discussion started by: greycells
0 Replies

8. Shell Programming and Scripting

Parse a string as a command

I've a problem parsing a string as a command: Consider script stefano.sh as following: #!/usr/bin/sh txtshell="./parser.sh /ews/MyEventHandler/data/handler/StopAndMail.php eventid=StopAndMail.MVIN.6300 lot_number=1122FXB facility=EWSF3 'mailto=prova.prova@nohost.com, prova.test@nohost.com'... (2 Replies)
Discussion started by: buonstefano
2 Replies

9. Shell Programming and Scripting

parse a mixed alphanumeric string from within a string

Hi, I would like to be able to parse out a substring matching a basic pattern, which is a character followed by 3 or 4 digits (for example S1234 out of a larger string). The main string would just be a filename, like Thisis__the FileName_S1234_ToParse.txt. The filename isn't fixed, but the... (2 Replies)
Discussion started by: keaneMB
2 Replies

10. Programming

Perl parse string

Hi Perl Guys I have another perl question I have the following code that i have written Getopt::Long::config(qw( permute bundling )); my $OPT = {}; GetOptions($OPT, qw( ver=s help|h )) or die "options parsing failed"; This will allow the user to do something like... (4 Replies)
Discussion started by: ab52
4 Replies
Arch::DiffParser(3pm)					User Contributed Perl Documentation				     Arch::DiffParser(3pm)

NAME
Arch::DiffParser - parse file's diff and perform some manipulations SYNOPSIS
use Arch::DiffParser; my $dp = Arch::DiffParser->new; # usable for "annotate" functionality my $changes = $dp->parse_file("f.diff")->changes; $dp->parse($diff_content); $dp->parse("--- f1.c 2005-02-26 +++ f2.c 2005-02-28 ..."); # prints "f1.c, f2.c" printf "%s, %s ", $dp->filename1, $dp->filename2; # enclose lines in <span class="patch_{mod,orig,line,add,del}"> my $html = $dp->markup_content; DESCRIPTION
This class provides a limited functionality to parse a single file diff in unified format. Multiple diffs may be parsed sequentially. The parsed data is stored for the last diff, and is replaced on the following parse. METHODS
The following class methods are available: new, parse, parse_file, content, lines, filename1, filename2, mtime1, mtime2, hunks, changes. new Construct the "Arch::DiffParser" instanse. parse diff_content Parse the diff_content and store its parsed data. parse_file diff_filename Like parse, but read the diff_content from diff_filename. diff_data Return hashref containing certain parsed data. Die if called before any parse methods. The keys are: "lines", "filename1", "filename2", "mtime1", "mtime2", "hunks", "changes". The value of "hunks" and "changes" is arrayref of arrayrefs with 5 elements: [ line-number-1, num-lines-1, line-number-2, num-lines-2, "lines"-index ]. A "hunk" describes a set of lines containing some combination of unmodified, deleted and added lines, a "change" describes an inter- hunk atom that only contains zero or more deleted lines and zero or more added lines. lines filename1 filename2 mtime1 mtime2 hunks changes These methods are just shortcuts for diff_data->{method}. content [%args] Return content of the last diff. %args keys are "fileroot1" and "fileroot2"; if given, these will replace the subdirs "orig" and "mod" that arch usually uses in the filepaths. markup_content [%args] Like content, but every non-context line is enclosed into markup <span class="patch_name">line</span>, where name is one of "orig" (filename1), "mod" (filename2), "line" (hunk linenums), "add" (added), del (deleted). Not implemented yet. BUGS
No support for newlines in source file names yet. AUTHORS
Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel). SEE ALSO
For more information, see Text::Diff::Unified, Algorithm::Diff. perl v5.10.1 2005-03-09 Arch::DiffParser(3pm)
All times are GMT -4. The time now is 11:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy