Sponsored Content
Top Forums Shell Programming and Scripting sed, awk [TAG]$content[/TAG] How to get var in $content in textfile? Post 302400967 by atmosroll on Thursday 4th of March 2010 03:52:24 PM
Old 03-04-2010
sed, awk [TAG]$content[/TAG] How to get var in $content in textfile?

Hello,

I got a Qstion. Im posting to a phpbb forum with bash and curl.. i have a text file with the following tags that i post to the forum:


Code:
[bb]$var1[/bb]
        
[aa]$var2[/aa]
        
[cc]$var3[/cc]


How can i with sed or awk put var content from shell script between the [tags]...[/tags] in the textfile? I tried with awk and sed to replace it. But i just dont get it to work Smilie

thanx in advance
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read a file content with awk and sed

Hello , I have huge file with below content. I need to read the numeric values with in the paranthesis after = sign. Please help me with awk and sed script for it. 11.10.2009 04:02:47 Customer login not found: identifier=(0748502889) prefix=(TEL) serviceCode=(). 11.10.2009 04:03:12... (13 Replies)
Discussion started by: rmv
13 Replies

2. Shell Programming and Scripting

changing files content with sed or awk

Hi, Example File: (jumped, bumped, ) how to jumped, FROM tree; EXIT I have some hundreads of files like this with the different words and I want to remove the comma before the bracket and also I have to remove the comma before FROM word. I am trying to use this command : awk '... (5 Replies)
Discussion started by: rajshashi
5 Replies

3. Shell Programming and Scripting

How to retrieve the value from XML tag whose end tag is in next line

Hi All, Find the following code: <Universal>D38x82j1JJ </Universal> I want to retrieve the value of <Universal> tag as below: Please help me. (3 Replies)
Discussion started by: mjavalkar
3 Replies

4. HP-UX

XML tag name content replacement

Hi, Need to replace an XML tag name contents, please provide any suggestions. Scenario is : <abc_def>Value_some_content</abc_def> Expected output : <abc:def>Value_some_content</abc:def> We have many tag with different names & contents in a file or a string. Please help on the... (3 Replies)
Discussion started by: periyasamycse
3 Replies

5. Shell Programming and Scripting

Search for a html tag and print the entire tag

I want to print from <fruits> to </fruits> tag which have <fruit> as mango. Also i want both <fruits> and </fruits> in output. Please help eg. <fruits> <fruit id="111">mango<fruit> . another 20 lines . </fruits> (3 Replies)
Discussion started by: Ashik409
3 Replies

6. Shell Programming and Scripting

XML Parse between to tag with upper tag

Hi Guys Here is my Input : <?xml version="1.0" encoding="UTF-8"?> <xn:MeContext id="01736"> <xn:VsDataContainer id="01736"> <xn:attributes> <xn:vsDataType>vsDataMeContext</xn:vsDataType> ... (12 Replies)
Discussion started by: pareshkp
12 Replies

7. Shell Programming and Scripting

To search for a particular tag in xml and collate all similar tag values and display them count

I want to basically do the below thing. Suppose there is a tag called object1. I want to display an output for all similar tag values under heading of Object 1 and the count of the xmls. Please help File: <xml><object1>house</object1><object2>child</object2>... (9 Replies)
Discussion started by: srkmish
9 Replies

8. Shell Programming and Scripting

Moving XML tag/contents after specific XML tag within same file

Hi Forum. I have an XML file with the following requirement to move the <AdditionalAccountHolders> tag and its content right after the <accountHolderName> tag within the same file but I'm not sure how to accomplish this through a Unix script. Any feedback will be greatly appreciated. ... (19 Replies)
Discussion started by: pchang
19 Replies

9. Shell Programming and Scripting

find files in sub dir with tag & add "." at the beginning [tag -f "Note" . | xargs -0 {} mv {} .{}]

I am trying find files in sub dir with certain tags using tag command, and add the period to the beginning. I can't use chflags hidden {} cause it doesn't add period to the beginning of the string for web purpose. So far with my knowledge, I only know mdfind or tag can be used to search files with... (6 Replies)
Discussion started by: Nexeu
6 Replies
GET_META_TAGS(3)							 1							  GET_META_TAGS(3)

get_meta_tags - Extracts all meta tag content attributes from a file and returns an array

SYNOPSIS
array get_meta_tags (string $filename, [bool $use_include_path = false]) DESCRIPTION
Opens $filename and parses it line by line for <meta> tags in the file. The parsing stops at </head>. PARAMETERS
o $filename - The path to the HTML file, as a string. This can be a local file or an URL. Example #1 What get_meta_tags(3) parses <meta name="author" content="name"> <meta name="keywords" content="php documentation"> <meta name="DESCRIPTION" content="a php manual"> <meta name="geo.position" content="49.33;-86.59"> </head> <!-- parsing stops here --> (pay attention to line endings - PHP uses a native function to parse the input, so a Mac file won't work on Unix). o $use_include_path - Setting $use_include_path to TRUE will result in PHP trying to open the file along the standard include path as per the include_path directive. This is used for local files, not URLs. RETURN VALUES
Returns an array with all the parsed meta tags. The value of the name property becomes the key, the value of the content property becomes the value of the returned array, so you can eas- ily use standard array functions to traverse it or access single values. Special characters in the value of the name property are substi- tuted with '_', the rest is converted to lower case. If two meta tags have the same name, only the last one is returned. EXAMPLES
Example #2 What get_meta_tags(3) returns <?php // Assuming the above tags are at www.example.com $tags = get_meta_tags('http://www.example.com/'); // Notice how the keys are all lowercase now, and // how . was replaced by _ in the key. echo $tags['author']; // name echo $tags['keywords']; // php documentation echo $tags['description']; // a php manual echo $tags['geo_position']; // 49.33;-86.59 ?> NOTES
Note Only meta tags with name attributes will be parsed. Quotes are not required. SEE ALSO
htmlentities(3), urlencode(3). PHP Documentation Group GET_META_TAGS(3)
All times are GMT -4. The time now is 11:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy