Search Results

Search: Posts Made By: alexscript
3,322
Posted By Chubler_XL
This function should be closer to what you want -...
This function should be closer to what you want - It stops at the first occurance.

function param_val {
awk "/^${1}=/{gsub(/^${1}="'/,""); print; exit}' $2
}

eg:
$ awk...
3,322
Posted By Chubler_XL
Yes -n causes nothing to print unless a /p is...
Yes -n causes nothing to print unless a /p is used this ensures only the line with your paramter is printed, to test from command try:

$ sed -n "s/^Name=//p"...
3,322
Posted By Corona688
You're looking for something too specific. {...
You're looking for something too specific.

{ } work when substituting any shell variable in any context shell variables can be substituted in. It's normal syntax, and the safe way to do...
3,322
Posted By Chubler_XL
I find myself doing this sort of thing a fair bit...
I find myself doing this sort of thing a fair bit and setting up a local param_val() function makes the code much more maintainable/extendable/readable,
and as long as your only processing a few...
3,322
Posted By agama
I don't see the need for the ls either: ...
I don't see the need for the ls either:


#!/usr/bin/env ksh
awk '
function printit( )
{
print "Entry = \42" name "\42 {Actions = \42Exec " executable "\42 }"
name =...
4,244
Posted By gary_w
Those are not single quotes but backquotes, also...
Those are not single quotes but backquotes, also called a grave accent mark. Usually to the left of the number 1 key. You can also do this which handles nesting commands better:
name=$(cat $i |...
4,244
Posted By bartus11
name=`cat $i | grep ^Name= | cut -d = -f2`
name=`cat $i | grep ^Name= | cut -d = -f2`
Showing results 1 to 7 of 7

 
All times are GMT -4. The time now is 06:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy