Sponsored Content
Top Forums Shell Programming and Scripting ksh String Manipulation - removing variables from within a variable Post 303029760 by wisecracker on Thursday 31st of January 2019 04:19:03 PM
Old 01-31-2019
Hi RudiC & bakunin...

I learn something new every day.
That expansion, new to me, works in bash too.
(Sadly it is not POSIX compliant though.)


Super stuff.
Thanks a mil'.


Bazza.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

extract from string variable into new variables

I have a variable which consists of a string like this: 001 aaabc 44 a bbb12 How do I extract each substring, delimited by the spaces, into new variables - one for each substring? eg var1 will be 001, var2 will be aaabc, var3 will be 44, var4 will be a, etc? I've come up with this:... (2 Replies)
Discussion started by: Sniper Pixie
2 Replies

2. Shell Programming and Scripting

KSH split string into variables

Hello, I am an intermediate scripter. I can usually find and adapt what I need by searching through previous postings, but I'm stumped. I have a string with the format "{Name1 Release1 Type1 Parent1} {Name2 Release2 Type2 Parent2}". It is being passed as an argument into a ksh script. I need to... (5 Replies)
Discussion started by: drd_2b
5 Replies

3. UNIX for Dummies Questions & Answers

String manipulation using ksh

I have a UNIX shell where: LEVEL=dev SITE=here and WHEREIAM=/tmp/$SITE/location/$LEVEL I want to echo $WHEREIAM in such a way that I get it back with all the environment variables resolved (/tmp/here/location/dev). This command will be used in a shell script. (5 Replies)
Discussion started by: zambo
5 Replies

4. Shell Programming and Scripting

string manipulation in ksh

Hi all, I'm trying to extract the name of a script that is being run with a full path. i.e. if the script name is /some/where/path/script_name.ksh I'd like to extract only: script_name i know that it is possible to do so in two phases: echo "${0##*/}" will give me script_name.ksh and... (4 Replies)
Discussion started by: iceman
4 Replies

5. Shell Programming and Scripting

Bash string variable manipulation

In a bash script I've set a variable that is the directory name of where an executable lives. the_dir=`dirname $which myscript` which equates to something like "/path/to/dir/bin" I need to cut that down to remove the "bin" so I now have "/path/to/dir/". This sounds easy but as a... (2 Replies)
Discussion started by: Witty
2 Replies

6. Shell Programming and Scripting

Bash:How to split one string variable in two variables?

Hello, I have a paramter $param consisting just of two literals and want to split it into two parameters, so I can combine it to a new parameter <char1><string><char2>, but the following code didn't work: tmp_PARAM_1=cut -c1 $PARAM tmp_PARAM_2=cut -c2 $PARAM... (2 Replies)
Discussion started by: ABE2202
2 Replies

7. Shell Programming and Scripting

Ksh in Linux Removing: "\0" From String

Hi All, I am facing a problem and I am not able to solve it. I have already searched google, but nothing (maybe I am not using the correct key words). As a database query result, I have a file like below: fmv:/home/fmv/tmp>cat TestBackRef.txt /^TEST\(\{4\}\)X\{12\}Y\.txt$/\0#\1/#Test... (2 Replies)
Discussion started by: felipe.vinturin
2 Replies

8. Shell Programming and Scripting

String manipulation using ksh script

Hi, I need to convert string "(joe.smith" into "joe_smith" i.e. I need to remove the leading opening brace '(' and replace the dot '.' with an under score '_' can anyone suggest a one liner ksh script or unix command for this please (3 Replies)
Discussion started by: sdj
3 Replies

9. Shell Programming and Scripting

How to convert string(variable) into date( epoch) in ksh on HPUX machine?

Hi all, I have used a bash script which ultimately converts a string into date using date --date option: DATE=$DATE" "$TIME" "`date +%Y` //concatenating 2 strings TMRW_DATE=`date --date="$DATE" +"%s"` //applying date command on string and getting the unixtime Please use code tags... (7 Replies)
Discussion started by: Rashu123
7 Replies

10. Shell Programming and Scripting

Variable string manipulation

Hi, I have a variable with grep output like this: WORDS=$(grep -r -c -i -E "palindrom" /"$DIRECTORY"/) so "echo "$WORDS"" could be: //directory/file1.txt:0 //directory/file2.txt:0 //directory/file3.txt:3 //directory/file4.txt:1 //directory/file5.txt:0 I need to "sed" my variable... (3 Replies)
Discussion started by: Hornys
3 Replies
SUPERIOTOOL(8)						      System Manager's Manual						    SUPERIOTOOL(8)

NAME
superiotool - Super I/O detection tool SYNOPSIS
superiotool [-delVvh] DESCRIPTION
superiotool is a GPL'd user-space utility which can * detect which Super I/O chip is soldered onto your mainboard, * at which configuration port it's located (usually 0x2e or 0x4e), and * dump all register contents of the Super I/O chip, together with the default values as per datasheet (to make comparing the values easy). It is mainly used for coreboot development purposes (see coreboot.org for details on coreboot), but it may also be useful for other things. The list of supported Super I/O chips is available at http://coreboot.org/Superiotool#Supported_devices, but it can also be viewed by run- ning superiotool -l. OPTIONS
If no command line option is specified, superiotool merely tries to detect the Super I/O chip. You must use the -d option to dump the Super I/O register contents. -d, --dump Dump Super I/O registers (if the Super I/O chip is detected and superiotool supports the --dump option for this chip). The output will look something like this: $ superiotool -d Found SMSC FDC37N769 (id=0x28, rev=0x01) at 0x3f0 Register dump: idx 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11... val 20 90 80 f4 00 00 ff 00 00 00 40 00 0e 28 01 00 00 00... def 28 9c 88 70 00 00 ff 00 00 00 00 00 02 28 NA 00 00 80... The idx fields contain the register numbers/indexes of the Super I/O, the val fields contain the contents of the respective register as read from the Super I/O, and the def fields contain the default values for the respective register, as specified in the datasheet. The numbers in the output are all in hex format, and some special values may also occur: NA stands for not available (i.e., the datasheet doesn't specify a default value for the respective register), RR means reserved (the datasheet explicitly marks this reg- ister as reserved), and MM means misc, which can mean several things. It's recommended to consult the datasheet for detailed infor- mation about the MM fields. -e, --extra-dump Dump extra secondary register contents too, if available. Only in combination with the --dump option. This option will, for instance, dump the environmental controller (EC) configuration registers for the ITE IT8716F chip. The format is similar to the out- put of the --dump option. -l, --list-supported List all Super I/O chips recognized by superiotool. The phrase (dump available) following a chip name indicates that superiotool supports the --dump option for this chip. -V, --verbose Enable verbose mode. This option can be used together with the -d option. The verbose output will not only list for which type of Super I/O the tool is scanning, but also at which configuration port it's probing, and which Super I/O initialization sequence is used. If no Super I/O was detected in a probing run, the returned output will be shown, as it may be useful for figuring out which (currently unrecognized) Super I/O chip this may be. -v, --version Show version information and exit. -h, --help Show a help text and exit. BUGS
Please report any bugs at http://tracker.coreboot.org/trac/coreboot/newticket or on the coreboot mailing list (http://coreboot.org/Mail- inglist). AUTHORS
Please see the individual source code files and/or the README file. LICENCE
superiotool is covered by the GNU General Public License (GPL), either version 2 of the License, or (at your option) any later version. SEE ALSO
sensors-detect(8) January 18, 2008 SUPERIOTOOL(8)
All times are GMT -4. The time now is 08:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy