Sponsored Content
Operating Systems Linux Debian Using sed with bash variables Post 302945874 by RudiC on Thursday 4th of June 2015 05:32:36 AM
Old 06-04-2015
Please use code tags as required by forum rules!

The single quotes prevent the variable from expansion, so the literal name is inserted. Try using double quotes instead, and don't escape the $ with the \ . Some seds insist on a line break before the insertion text.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using sed on bash variables (or maybe awk?)

Hi all- I've been fooling with this for a few days, but I'm rather new at this... I have a bash variable containing a long string of various characters, for instance: JUNK=this that the other xyz 1234 56 789 I don't know what "xyz" actually is, but I know that: START=he other and ... (2 Replies)
Discussion started by: rev66
2 Replies

2. Shell Programming and Scripting

Bash variables

Ummm can anybody help me with this one? Its prob quite simple. I bascially have a file name say J1x2x3x7.dat Im using the file name as a variable in a bash script. Want I want to do is extract most of the file name and make it a new variable expect with say one of the number now a... (2 Replies)
Discussion started by: RichieFondel
2 Replies

3. Shell Programming and Scripting

how to use in bash variables and quotes

I have some troubles with variables and quotes... I want: if $URL is empty (no user input) go to http://www.localhost/index.php/ else add this string (search) "?s=+$URL" EXAMPLE: No user input string= http://www.localhost/index.php/ User input = "unix" string=... (3 Replies)
Discussion started by: aspire
3 Replies

4. UNIX for Dummies Questions & Answers

Expanding variables with Ed Bash 3.2.33

Hi, The following code finds the line containing fruits in test.txt and replaces instances of apple with banana. ed -s test.txt <<< $'/fruits/s/apple/banana/g\nw' What I want to do is put variables in the place of fruits, apple and banana. I have tried replacing ' with " to get... (2 Replies)
Discussion started by: de_la_espada
2 Replies

5. Shell Programming and Scripting

Complex bash/sed, variables and nested quotes

Ok, this one isn't for everybody, it's pretty tough and I've spent a good deal of time on it without figuring it out yet. Can anybody get this script to work: #!/bin/bash cq_fname="%let outputfile="/user/cq_"$1".csv";" sed "29s/.*/\"$cq_fname\"/" file1.sas >... (3 Replies)
Discussion started by: nocloud
3 Replies

6. Shell Programming and Scripting

Indirect variables in Bash

Hello, I've spent hours this morning reading various past forum posts and documentation pages but I can't find exactly what I need. I'm trying to call a variable with a variable in the name without having to make a third variable. For example: path=AB legAB=50 leg$path I want to... (8 Replies)
Discussion started by: DFr0st
8 Replies

7. Shell Programming and Scripting

BASH arrays and variables of variables in C++

Sometimes it is handy to protect long scripts in C++. The following syntax works fine for simple commands: #define SHELLSCRIPT1 "\ #/bin/bash \n\ echo \"hello\" \n\ " int main () { cout <<system(SHELLSCRIPT1); return 0; } Unfortunately for there are problems for: 1d arrays:... (10 Replies)
Discussion started by: frad
10 Replies

8. Shell Programming and Scripting

Expect - bash and variables

I was wondering if anyone could provide some assistance. I trying to run an expect script within bash and get the results of a variable called RESULT. I Have tried a few things but none of them have worked. I know that the child process (the expect script) in this instance cannot set a variable... (6 Replies)
Discussion started by: ylafont
6 Replies

9. Shell Programming and Scripting

Passing awk variables to bash variables

Trying to do so echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies
Pod::ParseLink(3pm)					 Perl Programmers Reference Guide				       Pod::ParseLink(3pm)

NAME
Pod::ParseLink - Parse an L<> formatting code in POD text SYNOPSIS
use Pod::ParseLink; my ($text, $inferred, $name, $section, $type) = parselink ($link); DESCRIPTION
This module only provides a single function, parselink(), which takes the text of an L<> formatting code and parses it. It returns the anchor text for the link (if any was given), the anchor text possibly inferred from the name and section, the name or URL, the section if any, and the type of link. The type will be one of "url", "pod", or "man", indicating a URL, a link to a POD page, or a link to a Unix manual page. Parsing is implemented per perlpodspec. For backward compatibility, links where there is no section and name contains spaces, or links where the entirety of the link (except for the anchor text if given) is enclosed in double-quotes are interpreted as links to a section (L</section>). The inferred anchor text is implemented per perlpodspec: L<name> => L<name|name> L</section> => L<"section"|/section> L<name/section> => L<"section" in name|name/section> The name may contain embedded E<> and Z<> formatting codes, and the section, anchor text, and inferred anchor text may contain any formatting codes. Any double quotes around the section are removed as part of the parsing, as is any leading or trailing whitespace. If the text of the L<> escape is entirely enclosed in double quotes, it's interpreted as a link to a section for backward compatibility. No attempt is made to resolve formatting codes. This must be done after calling parselink() (since E<> formatting codes can be used to escape characters that would otherwise be significant to the parser and resolving them before parsing would result in an incorrect parse of a formatting code like: L<verticalE<verbar>barE<sol>slash> which should be interpreted as a link to the "vertical|bar/slash" POD page and not as a link to the "slash" section of the "bar" POD page with an anchor text of "vertical". Note that not only the anchor text will need to have formatting codes expanded, but so will the target of the link (to deal with E<> and Z<> formatting codes), and special handling of the section may be necessary depending on whether the translator wants to consider markup in sections to be significant when resolving links. See perlpodspec for more information. SEE ALSO
Pod::Parser The current version of this module is always available from its web site at <http://www.eyrie.org/~eagle/software/podlators/>. AUTHOR
Russ Allbery <rra@stanford.edu>. COPYRIGHT AND LICENSE
Copyright 2001, 2008, 2009 Russ Allbery <rra@stanford.edu>. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-11-04 Pod::ParseLink(3pm)
All times are GMT -4. The time now is 04:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy