Sponsored Content
Top Forums Shell Programming and Scripting Replace environment variables with sed Post 302219464 by BMDan on Tuesday 29th of July 2008 07:39:54 AM
Old 07-29-2008
Quote:
Originally Posted by alex_5161
----- the dot after \( is represents an any character. The * after the dot means 'to have a character 0 or more times' (Therefore I do not understand the BMDancorrection with addition the [^=] - the ^ inside of the [] means 'not'; not sure if '=' get some meaning, but without any special meaning the [^=]* means: 'does not have '=' 0 or more times' that make no sence for me. Also, Ive checked the 'PASS=' and it has been selected (as expected) by the ^.*PASS= ... - so, I am not clear what the note was about)
Try the following as an input:

Code:
SECRETPASS=n0b0dyc4nevergue55myPASS=word

and you'll understand my change. "Does not have '=' 0 or more times" is a poor way to describe it; "0 or more characters that aren't a '='", or more simply, "grab characters until you hit a '='" would be more accurate.
 

10 More Discussions You Might Find Interesting

1. Programming

environment variables

Hi! How-to get the environment variables in GNU. getenv() only fetches the ones that you can find under export (not the ones under declare)... best regars .David (2 Replies)
Discussion started by: Esaia
2 Replies

2. UNIX for Dummies Questions & Answers

environment variables

Hi Folks, Is it possible somehow to unset all the environment variables which have been defined before in UNIX (Solaris). Thanks, Slava (3 Replies)
Discussion started by: spavlov
3 Replies

3. Programming

environment variables

hi, I want to create a new EV(Environment Variable) through a c program and I done this thing through setenv() method. But the newly created EV is not permanent, i.e. when I exit from the program the EV also no longer lives. But I want to make it a permanent EV for the current user. Actually I... (6 Replies)
Discussion started by: sumsin
6 Replies

4. Shell Programming and Scripting

using sed to replace a specific string on a specific line number using variables

using sed to replace a specific string on a specific line number using variables this is where i am at grep -v WARNING output | grep -v spawn | grep -v Passphrase | grep -v Authentication | grep -v '/sbin/tfadmin netguard -C'| grep -v 'NETWORK>' >> output.clean grep -n Destination... (2 Replies)
Discussion started by: todd.cutting
2 Replies

5. Shell Programming and Scripting

replace two character strings by two variables with sed command

Hello, I want to writte a script that replace two character strings by two variables with the command sed butmy solution doesn't work. I'm written this: sed "s/TTFactivevent/$TTFav/g && s/switchSLL/$SLL/g" templatefile. I want to replace TTFactivevent by the variable $TTFav, that is a... (4 Replies)
Discussion started by: POPO10
4 Replies

6. Shell Programming and Scripting

environment variables in a sed script file

Hello Everyone I need to create a script file which must append some lines to a target text file, I'm using sed for windows, the script file look like this: { a\ STRINGTABLE DISCARDABLE\ BEGIN\ 5, 150 {a\ #define RC_SHELL, "%ID_SHELL%"\ #define RC_NAME, "%ID_NAME%"\ END } ... (1 Reply)
Discussion started by: edgarvm
1 Replies

7. HP-UX

Environment Variables

Hi Experts, Need your help in understanding the commands to setup the environment variables in hp-ux. Beleive need to use either set,setenv or export. I am confused between above three options, when to use which option? On command line, I have tried both set and setenv but couldn't... (1 Reply)
Discussion started by: sai_2507
1 Replies

8. Homework & Coursework Questions

Environment Variables

1. The problem statement: What is the mesg value set for your environment? If it is on, how would you turn off your current session? How would you set it permanently? 3. The attempts at a solution : Read Unix The textbook. 3rd chapter has many things like environment variables and... (5 Replies)
Discussion started by: mahinkhan22
5 Replies

9. Shell Programming and Scripting

Sed, replace variables in file

Hi Everyone, I need some help with sed and I'm totally new to it. I have a template file with variables in it. These variables start with a '$' sign and are exactly one character long (plus the '$' sign). For example: $a, $b, etc. Each variable should be replaced with the contents of a... (9 Replies)
Discussion started by: csarli2006
9 Replies

10. HP-UX

Environment Variables

Hi All, I need to understand following three environment variables and their usages in HP Unix. _M_ARENA_OPTS _M_CACHE_OPTS PTHREAD_SCOPE_SYSTEM How does these environment variables influence multi threaded applciation and how do we decide the value of these variables? Is there... (0 Replies)
Discussion started by: angshuman
0 Replies
MAP3270(5)							File Formats Manual							MAP3270(5)

NAME
map3270 - database for mapping ascii keystrokes into IBM 3270 keys SYNOPSIS
/usr/share/misc/map3270 DESCRIPTION
When emulating IBM-syle 3270 terminals under UNIX (see tn3270(1)), a mapping must be performed between sequences of keys hit on a user's (ascii) keyboard, and the keys that are available on a 3270. For example, a 3270 has a key labeled EEOF which erases the contents of the current field from the location of the cursor to the end. In order to accomplish this function, the terminal user and a program emulating a 3270 must agree on what keys will be typed to invoke the EEOF function. The requirements for these sequences are: 1.) that the first character of the sequence be outside of the standard ascii printable characters; 2.) that no one sequence be an initial part of another (although sequences may share initial parts). FORMAT
The file consists of entries for various terminals. The first part of an entry lists the names of the terminals which use that entry. These names should be the same as in /etc/termcap (see termcap(5)); note that often the terminals from various termcap entries will all use the same map3270 entry; for example, both 925 and 925vb (for 925 with visual bells) would probably use the same map3270 entry. After the names, separated by vertical bars (`|'), comes a left brace (`{'); the definitions; and, finally, a right brace (`}'). The definitions consist of a reserved keyword (see list below) which identifies the 3270 function (extended as defined below), followed by an equal sign (`='), followed by the various ways to generate this particular function, followed by a semi-colon (`;'). Each way is a sequence of strings of printable ascii characters enclosed inside single quotes (`''); various ways (options) are separated by vertical bars (`|'). Inside the single quotes, a few characters are special. A caret (`^') specifies that the next character is the ``control'' character of whatever the character is. So, `^a' represents control-a, ie: hexadecimal 1 (note that `^A' would generate the same code). To generate rubout, one enters `^?'. To represent a control character inside a file requires using the caret to represent a control sequence; simply typing control-A will not work. Note: the ctrl-caret sequence (to generate a hexadecimal 1E) is represented as `^^' (not `^^'). In addition to the caret, a letter may be preceeded by a backslash (`'). Since this has little effect for most characters, its use is usually not recommended. For the case of a single quote (`''), the backslash prevents that single quote from terminating the string. To have the backslash be part of the string, it is necessary to place two backslashes ('\') in the file. In addition, the following characters are special: `E' means an escape character; ` ' means newline; ` ' means tab; ` ' means carriage return. It is not necessary for each character in a string to be enclosed within single quotes. `EEE' means three escape characters. Comments, which may appear anywhere on a line, begin with a hash mark (`#'), and terminate at the end of that line. However, comments can- not begin inside a quoted string; a hash mark inside a quoted string has no special meaning. 3270 KEYS SUPPORTED The following is the list of 3270 key names that are supported in this file. Note that some of the keys don't really exist on a 3270. In particular, the developers of this file have relied extensively on the work at the Yale University Computer Center with their 3270 emulator which runs in an IBM Series/1 front end. The following list corresponds closely to the functions that the developers of the Yale code offer in their product. In the following list, the starred ("*") functions are not supported by tn3270(1). An unsupported function will cause tn3270(1) to send a bell sequence to the user's terminal. 3270 Key Name Functional description (*)LPRT local print DP dup character FM field mark character (*)CURSEL cursor select RESHOW redisplay the screen EINP erase input EEOF erase end of field DELETE delete character INSRT toggle insert mode TAB field tab BTAB field back tab COLTAB column tab COLBAK column back tab INDENT indent one tab stop UNDENT undent one tab stop NL new line HOME home the cursor UP up cursor DOWN down cursor RIGHT right cursor LEFT left cursor SETTAB set a column tab DELTAB delete a columntab SETMRG set left margin SETHOM set home position CLRTAB clear all column tabs (*)APLON apl on (*)APLOFF apl off (*)APLEND treat input as ascii (*)PCON xon/xoff on (*)PCOFF xon/xoff off DISC disconnect (suspend) (*)INIT new terminal type (*)ALTK alternate keyboard dvorak FLINP flush input ERASE erase last character WERASE erase last word FERASE erase field SYNCH we are in synch with the user RESET reset key-unlock keyboard MASTER_RESET reset, unlock and redisplay (*)XOFF please hold output (*)XON please give me output ESCAPE enter telnet command mode WORDTAB tab to beginning of next word WORDBACKTAB tab to beginning of current/last word WORDEND tab to end of current/next word FIELDEND tab to last non-blank of current/next unprotected (writable) field. PA1 program attention 1 PA2 program attention 2 PA3 program attention 3 CLEAR local clear of the 3270 screen TREQ test request ENTER enter key PFK1 program function key 1 PFK2 program function key 2 etc. etc. PFK36 program function key 36 A SAMPLE ENTRY
The following entry is used by tn3270(1) when unable to locate a reasonable version in the user's environment and in /usr/share/misc/map3270: name { # actual name comes from TERM variable clear = '^z'; flinp = '^x'; enter = '^m'; delete = '^d' | '^?'; # note that '^?' is delete (rubout) synch = '^r'; reshow = '^v'; eeof = '^e'; tab = '^i'; btab = '^b'; nl = '^n'; left = '^h'; right = '^l'; up = '^k'; down = '^j'; einp = '^w'; reset = '^t'; xoff = '^s'; xon = '^q'; escape = '^c'; ferase = '^u'; insrt = ' '; # program attention keys pa1 = '^p1'; pa2 = '^p2'; pa3 = '^p3'; # program function keys pfk1 = '1'; pfk2 = '2'; pfk3 = '3'; pfk4 = '4'; pfk5 = '5'; pfk6 = '6'; pfk7 = '7'; pfk8 = '8'; pfk9 = '9'; pfk10 = ' '; pfk11 = '-'; pfk12 = '='; pfk13 = ''; pfk14 = '@'; pfk15 = ' pfk17 = ''; pfk18 = ''; pfk19 = ''; pfk20 = '; pfk21 = ' pfk22 = ''; pfk23 = '_'; pfk24 = '+'; } IBM 3270 KEY DEFINITONS FOR AN ABOVE DEFINITION The charts below show the proper keys to emulate each 3270 function when using the default key mapping supplied with tn3270(1) and mset(1). Command Keys IBM 3270 Key Default Key(s) Enter RETURN Clear control-z Cursor Movement Keys New Line control-n or Home Tab control-i Back Tab control-b Cursor Left control-h Cursor Right control-l Cursor Up control-k Cursor Down control-j or LINE FEED Edit Control Keys Delete Char control-d or RUB Erase EOF control-e Erase Input control-w Insert Mode ESC Space End Insert ESC Space Program Function Keys PF1 ESC 1 PF2 ESC 2 ... ... PF10 ESC 0 PF11 ESC - PF12 ESC = PF13 ESC ! PF14 ESC @ ... ... PF24 ESC + Program Attention Keys PA1 control-p 1 PA2 control-p 2 PA3 control-p 3 Local Control Keys Reset After Error control-r Purge Input Buffer control-x Keyboard Unlock control-t Redisplay Screen control-v Other Keys Erase current field control-u FILES
/usr/share/misc/map3270 SEE ALSO
tn3270(1), mset(1), Yale ASCII Terminal Communication System II Program Description/Operator's Manual (IBM SB30-1911) AUTHOR
Greg Minshall BUGS
Tn3270 doesn't yet understand how to process all the functions available in map3270; when such a function is requested tn3270 will beep at you. The definition of "word" (for "word delete", "word tab") should be a run-time option. Currently it is defined as the kernel tty driver defines it (strings of non-blanks); more than one person would rather use the "vi" definition (strings of specials, strings of alphanu- meric). 4.3 Berkeley Distribution November 27, 1996 MAP3270(5)
All times are GMT -4. The time now is 04:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy