Sponsored Content
Full Discussion: Parse String from a Variable
Top Forums Shell Programming and Scripting Parse String from a Variable Post 302182728 by in2nix4life on Monday 7th of April 2008 12:04:29 PM
Old 04-07-2008
If you're looking to do it in a single line, try this:

echo $TA | perl -pe 's/^\[(.*) (.*)\]$/$1\n$2/' > file.txt

Hope this helps.
 

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

parse variable

I have a variable (it is a date actually -> 2007-01-03) which would be passed in as parameter, what I want is to parse in and put year, month, and day in separate variables, I have tried the following but doesn't work echo $dt | awk -F- '{print $1 $2 $3}' | read y m d Thanks in... (2 Replies)
Discussion started by: mpang_
2 Replies

3. Shell Programming and Scripting

how to parse this string

I want to get filenames from the following input. How can I parse this in bash. input data ------------------------------------------------------------------- path=/aaa/bbb/filename1;/aaa/filename2;/aaa/bbb/ccc/ddd/filename3 -------------------------------------------------------------------... (13 Replies)
Discussion started by: hcliff
13 Replies

4. Shell Programming and Scripting

how to parse value of the variable

I have a variable which has a full path to the file, for example : A=/t1/bin/f410pdb Does anybody know the command to parce this variable and assign the result to 3 other variables so each subdirectory name will be in a new variable like this B=t1 C=bin D=f410pdb Many thanks -A (5 Replies)
Discussion started by: aoussenko
5 Replies

5. 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

6. UNIX for Advanced & Expert Users

How to parse nested variable

Hi, I want to parse nested variable in my script. for exp- c=1 G1='0318' G2='0023' G3='3092' G4='0014' while ;do g=G$c a=$g echo "Group=$g and value=$a" c=`expr $c + 1` done final output are as - --------------------------- Group=G1 and... (4 Replies)
Discussion started by: apskaushik
4 Replies

7. 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

8. Shell Programming and Scripting

How to parse xml file in variable-string?

In the wake of the post: how-parse-following-xml-file Thank you for the very useful chakrapani response 302355585-post4 ! A close question. How to pass a file to xmllint in variable? For example, let it be: NEARLY_FILE='<?xml version="1.0" encoding="iso-8859-1"?><html><set label="09/07/29"... (0 Replies)
Discussion started by: OleM2k
0 Replies

9. Shell Programming and Scripting

Help about parse the variable

I'm using bash the code is QEMU_CMD="qemu-system-x86_64 -smp 2 -m 512 $QEMU_PARAMETER -hda $GUEST_IMAGE -kernel $GUEST_KERNEL -append \"root=/dev/hda rw console=ttyS0,115200 ip=$IP_PARAMETER \" -nographic" echo "..............................." echo "qemu command is... (9 Replies)
Discussion started by: yanglei_fage
9 Replies

10. UNIX for Beginners Questions & Answers

Grepping for one variable while using awk to parse an associated variable

Im trying to search for a single variable in the first field and from that output use awk to extract out the lines that contain a value less than a value stored in another variable. Both the variables are associated with each other. Any guidance is appreciated. File that contains the... (6 Replies)
Discussion started by: ncwxpanther
6 Replies
MULTIMARKDOWN(1p)					User Contributed Perl Documentation					 MULTIMARKDOWN(1p)

NAME
multimarkdown - Convert MultiMarkdown syntax to (X)HTML DESCRIPTION
This program is distributed as part of Perl's Text::MultiMarkdown module, illustrating sample usage. multimarkdown can be invoked on any file containing MultiMarkdown-syntax, and will produce the corresponding (X)HTML on STDOUT: $ cat file.txt [MultiMarkdown][] *extends* the very well-known [Markdown][] syntax. [MultiMarkdown]: http://fletcherpenney.net/What_is_MultiMarkdown [Markdown]: http://daringfireball.net/projects/markdown/ $ multimarkdown file.txt <p><a href="http://fletcherpenney.net/What_is_MultiMarkdown">MultiMarkdown</a> <em>extends</em> the very well-known <a href="http://daringfireball.net/projects/markdown/">Markdown</a> syntax.</p> If no file is specified, it will expect its input from STDIN: $ echo "A **simple** test" | multimarkdown <p>A <strong>simple</strong> test</p> OPTIONS
version Shows the full information for this version shortversion Shows only the version number html4tags Produce HTML 4-style tags instead of XHTML - XHTML requires elements that do not wrap a block (i.e. the "hr" tag) to state they will not be closed, by closing with "/>". HTML 4-style will plainly output the tag as it comes: $ echo '---' | multimarkdown <hr /> $ echo '---' | multimarkdown --html4tags <hr> help Shows this documentation AUTHOR
Copyright 2004 John Gruber Copyright 2006 Fletcher Penny Copyright 2008 Tomas Doran The manpage was written by Gunnar Wolf <gwolf@debian.org> for its use in Debian systems, but can be freely used elsewhere. For full licensing information, please refer to Text::MultiMarkdown.pm's full documentation. SEE ALSO
Text::MultiMarkdown, <http://fletcherpenney.net/What_is_MultiMarkdown> perl v5.12.4 2011-07-11 MULTIMARKDOWN(1p)
All times are GMT -4. The time now is 03:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy