Sponsored Content
Full Discussion: Help in replace method
Top Forums Shell Programming and Scripting Help in replace method Post 302371871 by Scrutinizer on Monday 16th of November 2009 12:35:21 PM
Old 11-16-2009
Code:
VARIABLE='john_*_has_*_s'

bash/ksh:
Code:
VARIABLE='john_*_has_*_s'
VARIABLE=${VARIABLE/\*/09100}
VARIABLE=${VARIABLE/\*/0010101}
echo $VARIABLE

sed:
Code:
echo $VARIABLE|sed 's/\*/09100/;s/\*/0010101/'

awk:
Code:
echo $VARIABLE|awk -F\* '{print $1 "09100" $2 "0010101" $3}'

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Backup method

Hi I'm trying to work out the best method for creating a backup under SCO OpenServer. I would like to perform unattended backups to tape of various file systems, possibly using a script etc. So far I've looked at the Backup Manager that comes with SCO and that cannot perform unattended... (2 Replies)
Discussion started by: synamics
2 Replies

2. Shell Programming and Scripting

which encryption method?

hello ppl, i've been coding a perl script for xchat and i need to store the nick's passwords. i was wondering which encryption to use. picture this situation: i've got a system flaw and some guy hacks the machine and gets his hands on the passwd file; he has access to the script. what encryption... (2 Replies)
Discussion started by: crashnburn
2 Replies

3. UNIX for Dummies Questions & Answers

Optimized Method

Hi All, I have got two files. File A with 50000 records and File B with some 500 million records. I need to extract the mapping data (common data) from both the files. There should be definitely many ways :) though I have a way which is definitely not optimzed and takes a longer time... (2 Replies)
Discussion started by: matrixmadhan
2 Replies

4. Programming

Regarding Native method

Hi, I am working with solaris 9 and I am using jre1.6. In my application,I am using java and C++ in my application.Basically we are using the java for front end and C/C++ for back hand.So I have to call the C/C++ source code form java code.we are using native methods for it.. So application... (1 Reply)
Discussion started by: smartgupta
1 Replies

5. Solaris

How to get the status of the method

Hi, I have created a services and method to start the processes. Method: #!/sbin/sh . /lib/svc/share/smf_include.sh case "$1" in 'start') /usr/local/proce start sleep 10 ;; 'stop') /usr/local/proce stop ;; *) echo... (5 Replies)
Discussion started by: kalpeer
5 Replies

6. Programming

message and method

Differentiate between the message and method. (2 Replies)
Discussion started by: robinglow
2 Replies

7. Solaris

svc:/network/physical:default: Method "/lib/svc/method/net-physical" failed with exit status 96. [ n

After a memory upgrade all network interfaces are misconfigued. How do i resolve this issue. Below are some out puts.thanks. ifconfig: plumb: SIOCLIFADDIF: eg000g0:2: no such interface # ifconfig eg1000g0:2 plumb ifconfig: plumb: SIOCLIFADDIF: eg1000g0:2: no such interface # ifconfig... (2 Replies)
Discussion started by: andersonedouard
2 Replies

8. Shell Programming and Scripting

Cleaner method for this if-then statement?

I have a script that runs once per month. It performs a certain task ONLY if the month is January, April, July, or October. MONTH=`date +%m` if || || || ; then do something else do a different thing fi Is there a neater way of doing it than my four separate "or" comparisons? That... (2 Replies)
Discussion started by: lupin..the..3rd
2 Replies

9. Shell Programming and Scripting

How to replace a text containing new lines using sed or any other method?

Hi, i want to replace "Hi How are You when did you go to delhi" to "Hi How are you when did you come from delhi" in a file. Any idea how to do it? (2 Replies)
Discussion started by: abhitanshu
2 Replies

10. Shell Programming and Scripting

Another method for this snippet

Hi All, i believe this is not very efficient. another method would be appreciated for these. basically i read a file with tab delimited column and pass the column to another perl script. while read line do timestamp=`echo "$line"|awk -F"\t" '{print $1}'` severity=`echo... (15 Replies)
Discussion started by: ryandegreat25
15 Replies
PRINTENV(1)							   User Commands						       PRINTENV(1)

NAME
printenv - print all or part of environment SYNOPSIS
printenv [VARIABLE]... printenv OPTION DESCRIPTION
Print the values of the specified environment VARIABLE(s). If no VARIABLE is specified, print name and value pairs for them all. --help display this help and exit --version output version information and exit NOTE: your shell may have its own version of printenv, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it supports. AUTHOR
Written by David MacKenzie and Richard Mlynarik. REPORTING BUGS
Report printenv bugs to bug-coreutils@gnu.org GNU coreutils home page: <http://www.gnu.org/software/coreutils/> General help using GNU software: <http://www.gnu.org/gethelp/> COPYRIGHT
Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
The full documentation for printenv is maintained as a Texinfo manual. If the info and printenv programs are properly installed at your site, the command info coreutils 'printenv invocation' should give you access to the complete manual. GNU coreutils 7.1 July 2010 PRINTENV(1)
All times are GMT -4. The time now is 02:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy