Sponsored Content
Top Forums Shell Programming and Scripting Combining a declared variable with a temporary variable Post 303027149 by clee on Monday 10th of December 2018 07:43:46 AM
Old 12-10-2018
Freaking outstanding, RudiC!


This construct WILL bed used. Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Combining Two fixed width columns to a variable length file

Hi, I have two files. File1: File1 contains two fixed width columns ID of 15 characters length and Name is of 100 characters length. ID Name 1-43<<11 spaces>>Swapna<<94 spaces>> 1-234<<10 spaces>>Mani<<96 spaces>> 1-3456<<9 spaces>>Kapil<<95 spaces>> File2: ... (4 Replies)
Discussion started by: manneni prakash
4 Replies

2. Shell Programming and Scripting

Insert a line including Variable & Carriage Return / sed command as Variable

I want to instert Category:XXXXX into the 2. line something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong: sed "2i\\${n}Category:$cat\n" Sample: Titel Blahh Blahh abllk sdhsd sjdhf Blahh Blah Blahh Blahh Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies

3. Shell Programming and Scripting

shell script: Bind variable not declared

Hi Friends, I am trying to run a sql query from shell script as below but I get "Bind variable "1" not declared" error. 1.sh shell script has following: sDb="abc/xyz@aaa" a="1.sql" sqlplus -s $sDb @$a $1 1.sql file has following: spool Result.tmp append select cust_name from orders... (1 Reply)
Discussion started by: ppat7046
1 Replies

4. Shell Programming and Scripting

How to define a variable with variable definition is stored in a variable?

Hi all, I have a variable say var1 (output from somewhere, which I can't change)which store something like this: echo $var1 name=fred age=25 address="123 abc" password=pass1234 how can I make the variable $name, $age, $address and $password contain the info? I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies

5. Shell Programming and Scripting

Variable not found error for a variable which is returned from stored procedure

can anyone please help me with this: i have written a shell script and a stored procedure which has one OUT parameter. now i want to use that out parameter as an input to the unix script but i am getting an error as variable not found. below are the unix scripts and stored procedure... ... (4 Replies)
Discussion started by: swap21783
4 Replies

6. Shell Programming and Scripting

Combining multiple variables into new variable

Hello, I am a new joiner to the forum, and have what i hope is a simple question, however I can't seem to find the answer so maybe it is not available within bash scripting. I intend to use the below script to archive files from multiple directories at once by using a loop, and a variable (n)... (10 Replies)
Discussion started by: dring
10 Replies

7. Shell Programming and Scripting

write in file using printf with variable declared with a phrase

Hi guys, kinda new to unix/linux, could you please help me figure this out. i need to write in a file using printf. printf "%-20s %-40s %-20s\n" $a $b $c >> out.txt but a, b and c are declared in a header file: a='I am a dog' b='I am a cat' c='I am a fish' i want the file to look like... (1 Reply)
Discussion started by: kokoro
1 Replies

8. Red Hat

How to pass value of pwd as variable in SED to replace variable in a script file

Hi all, Hereby wish to have your advise for below: Main concept is I intend to get current directory of my script file. This script file will be copied to /etc/init.d. A string in this copy will be replaced with current directory value. Below is original script file: ... (6 Replies)
Discussion started by: cielle
6 Replies

9. Shell Programming and Scripting

[Solved] How to increment and add variable length numbers to a variable in a loop?

Hi All, I have a file which has hundred of records with fixed number of fields. In each record there is set of 8 characters which represent the duration of that activity. I want to sum up the duration present in all the records for a report. The problem is the duration changes per record so I... (5 Replies)
Discussion started by: danish0909
5 Replies

10. UNIX for Advanced & Expert Users

Passing variable as input & storing output in other variable

I have a below syntax its working fine... var12=$(ps -ef | grep apache | awk '{print $2,$4}') Im getting expected output as below: printf "%b\n" "${VAR12}" dell 123 dell 456 dell 457 Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
Discussion started by: sam@sam
5 Replies
PPIx::EditorTools::IntroduceTemporaryVariable(3pm)	User Contributed Perl Documentation	PPIx::EditorTools::IntroduceTemporaryVariable(3pm)

NAME
PPIx::EditorTools::IntroduceTemporaryVariable - Introduces a temporary variable using PPI SYNOPSIS
my $munged = PPIx::EditorTools::IntroduceTemporaryVariable->new->introduce( code => "use strict; BEGIN { $^W = 1; } my $x = ( 1 + 10 / 12 ) * 2; my $y = ( 3 + 10 / 12 ) * 2; ", start_location => [ 2, 19 ], end_location => [ 2, 25 ], varname => '$foo', ); my $modified_code_as_string = $munged->code; my $location_of_new_var_declaration = $munged->element->location; DESCRIPTION
Given a region of code within a statement, replaces all occurrences of that code with a temporary variable. Declares and initializes the temporary variable right above the statement that included the selected expression. METHODS
new() Constructor. Generally shouldn't be called with any arguments. find( ppi => PPI::Document, start_location => Int, end_location => Int, varname => Str ) =item find( code => Str, start_location => Int, end_location => Int, varname => Str ) Accepts either a "PPI::Document" to process or a string containing the code (which will be converted into a "PPI::Document") to process. Given the region of code specified by start_location and end_location, replaces that code with a temporary variable with the name given in varname (defaults to "tmp"). Declares and initializes the temporary variable right above the statement that included the selected expression. Returns a "PPIx::EditorTools::ReturnObject" with the modified code as a string available via the "code" accessor (or as a "PPI::Document" via the "ppi" accessor), and the "PPI::Token" where the new variable is declared available via the "element" accessor. Croaks with a "no token" exception if no token is found at the location. Croaks with a "no statement" exception if unable to find the statement. SEE ALSO
This class inherits from "PPIx::EditorTools". Also see App::EditorTools, Padre, and PPI. perl v5.14.2 2012-03-11 PPIx::EditorTools::IntroduceTemporaryVariable(3pm)
All times are GMT -4. The time now is 11:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy