Sponsored Content
Top Forums Shell Programming and Scripting Wiki conversion with Awk or Sed Post 302421916 by rk4k on Monday 17th of May 2010 04:23:16 AM
Old 05-17-2010
Thank you pludi / Franklin52.

Respect Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String Conversion in awk

I am porting a awk script from Windows to unix I_SALE_MEDIA=$67 if ((I_VOID_FLAG == "Y") && (I_SALE_MEDIA == 0)) NOW consider the case where I_SALE_MEDIA i.e $67 is "000" The above comparison works fine in Windows , but to make it work in Unix , I had to change the above as follows : ... (3 Replies)
Discussion started by: rohanrege
3 Replies

2. Shell Programming and Scripting

awk script for date conversion

hi awk script for dd/mm/yyyy to yyyymmdd awk script for dd-mon-yyyy to yyyymmdd awk script for dd-mm-yyyy to yyyymmdd formate ..............urgent............. Thanks in advanced (2 Replies)
Discussion started by: charandevu
2 Replies

3. Shell Programming and Scripting

AWK Currency Conversion

How can I use awk command to convert values to currency. For example I have a database like follows John:200 smith:300 kim:405 and want it to out put like this John $200.00 (3 Replies)
Discussion started by: 3junior
3 Replies

4. Shell Programming and Scripting

File conversion and awk

Hi Everyone, I am confused with the output of the input file and I am using below command in script to get the expected output. Also I want to add another condition using logical AND (&&) in place of $2=="L"{$4=0-$4} as $2=="L" && $3=="L" {$4=0-$4} but I am getting some awk error. Can someone... (6 Replies)
Discussion started by: gehlnar
6 Replies

5. Shell Programming and Scripting

awk string to number conversion

Can someone explain whats happening here: $ awk 'BEGIN {print (2.5 - 1)}' 1,5 2.5 - 1 is correctly calculated to 1,5 (using european locale) $ echo "2.5" | awk '{temp = $1 - 1; print temp}' 1 If i now pipe the string 2.5 through awk it seems at it truncates 2.5 to 2? What's the... (4 Replies)
Discussion started by: beow
4 Replies

6. Shell Programming and Scripting

Most vexing: Sed or Awk scripting for date conversion needed

Hi, I have some files being sent to me that have dates in them in this format: from 1/8/2011 15:14:20 and I need the dates in this format (mysql date format) To 2011-01-08 15:14:20 all I have so far is the regexp that detects the format: sed -r -e 's@\1/\2/\3\4\5\6]::$@do... (7 Replies)
Discussion started by: Astrocloud
7 Replies

7. Shell Programming and Scripting

Conversion of line via awk or etc

Hello friends, could you help me about problem with my data lines. I suppose a simple awk code may help me. I have following data lines: (first line including 3 numbers and then a matrices of 4x10) 500 40 9 1 A B 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22... (6 Replies)
Discussion started by: rpf
6 Replies

8. Shell Programming and Scripting

Decimal conversion number of the form x.xx to 0x.xx, sed?

Hello I have a file of the form ... num 0.12 num num num 25.53 num num num 7.82 num num ...... and I want to convert the 2nd field of each line adding a "0" at the numbers >= 0 and < 10 so the output will have the form: ... num 00.12 num num num 25.53 num num num 07.82 num... (10 Replies)
Discussion started by: phaethon
10 Replies

9. Shell Programming and Scripting

Numeral conversion in awk

I am running into conversion of string to numbers in awk that I can't understand and don't know how to deal with properly My script checks for numeric only field, I use this approach to do that: $1 + 0 == $1 It works most of the time, but in some cases it does not behave how I expect it to... (5 Replies)
Discussion started by: migurus
5 Replies

10. Shell Programming and Scripting

Base64 conversion in awk overlaps

hi, problem: output is not consistent as expected using external command in AWK description: I'm trying to convert $2 into a base64 string for later decoding, and for this when I use awk , I'm getting overlapped results , or say it results are not 100% correct. my code is: gawk... (9 Replies)
Discussion started by: busyboy
9 Replies
mgettydefs(4)						       mgetty_sendfax manual						     mgettydefs(4)

NAME
mgettydefs - speed and terminal settings used by mgetty DESCRIPTION
The /etc/gettydefs file contains information used by mgetty(1) to set up the speed and terminal settings for a line. It also supplies information on what the login prompt should look like. Many versions of UNIX have a version of getty(1) that also reads /etc/gettydefs. Both mgetty and getty expect similar formats in /etc/get- tydefs except that, when used by mgetty, extended functionality is available. Even so, the additional functions are simply ignored by standard getty, so they can co-exist using the same file. Note, however, that mgetty can be compiled to use a file different from /etc/gettydefs if your getty gets upset about the extensions. This manual page documents /etc/gettydefs and describes the extended func- tionality available when used by mgetty(1). This document will refer to getty(1) except where mgetty's behaviour is different. Each entry in /etc/gettydefs has the following format: label# initial-flags # final-flags # login-prompt #next-label Each entry is followed by a blank line. The login prompt field can contain quoted characters which will be converted to other values. The sequences and their substitutions are: newline carriage return g beep  backspace v vertical tab (VT) f formfeed tab L portname C time in ctime(3) format. N number of users currently logged in U number of users currently logged in D date in DD/MM format T time in hh:mm:ss format I modem CONNECT attributes sequence where "sequence" is a valid strtol format, such as: nnn (octal), xnnn (hex), or nn (decimal). Note that standard getty usually only supports , and . The various fields are: label This is the string against which getty tries to match its second argument. It is often the speed, such as 1200, at which the terminal is supposed to run, but it need not be (see below). initial-flags These flags are the initial ioctl(2) settings to which the terminal is to be set if a terminal type is not specified to getty. The flags that getty understands are the ones listed in termio(7)). mgetty is usually compiled for termios(7) and often has a more complete set than getty. Normally only the speed flag is required in the initial-flags. getty automatically sets the terminal to raw input mode and takes care of the other flags. If the "-s" option is used with mgetty(1) the speed setting is ignored. The initial-flag settings remain in effect until getty executes login(1). final-flags These flags take the same values as the initial-flags and are set just before getty executes login. The speed flag is again required, except with mgetty if the -s flag was supplied. Two other commonly specified final-flags are TAB3, so that tabs are sent to the terminal as spaces, and HUPCL, so that the line is hung up on the final close. login-prompt This entire field is printed as the login-prompt. Unlike the above fields where white space (a space, tab or new-line) is ignored, they are included in the login-prompt field. This field is ignored if the "-p" option has been specified to mgetty(1). next-label specifies the label to use if the user user types a <break> character, or getty detects a reception error. Getty searches for the entry with next-label as its label field and set up the terminal for those settings. Usually, a series of speeds are linked together in this fashion, into a closed set; for instance, 2400 linked to 1200, which in turn is linked to 300, which finally is linked to 2400. next-label is ignored with mgetty(1). Several additional composite settings are available for initial-flags and final-flags. The following composite flags are supported by mgetty and are usually supported by getty: SANE equivalent to ``stty sane''. (BRKINT, IGNPAR, ISTRIP, ICRNL, IXON, OPOST, CS8, CREAD, ISIG, ICANON, ECHO, ECHOK) ODDP Odd parity (CS7, PARENB, PARODD) PARITY,EVENP even parity (CS7, PARENB) -ODDP,-PARITY,-EVENP no parity (resets PARENB, PARODD, and sets CS8) RAW raw I/O (no canonical processing) (turns off OPOST, ICANON) -RAW,COOKED enable canonical processing (turns on OPOST, ICANON) NL Ignore newlines. (ICRNL, ONLCR) -NL Respect newlines (turns INLCR, IGNCR, ICRNL, ONLCR, OCRNL, ONLRET off) LCASE Ignore case - treat all as lowercase. (IUCLC, OLCUC, XCASE) Is set if mgetty believes login is entirely uppercase. -LCASE Repect case (turns off IUCLC, OLCUC and XCASE) TABS output tabs as tabs -TABS,TAB3 output tabs as spaces EK Sets VERASE to "#" and VKILL to CKILL respectively. (note that while many gettys default VERASE to "#". mgetty defaults VERASE to backspace.) Additionally, mgetty (but not getty) can set any of the control characters listed in the c_cc termio(termios) structure by the use of two tokens: <character name> <value> Eg: VERASE ^h The value can be set as ``^<character>'', `` nn'' or ``<character>'' (normal UNIX escapes). See the termio(7) or termios(7) manual pages to a list of which ``V'' variables can be changed. Note that many of these can be changed in the c_cc array, but won't have any effect. If getty is called without a second argument, the first entry of /etc/gettydefs is used by getty, thus making the first entry of /etc/get- tydefs the default entry. It is also used if getty cannot find the specified label. Mgetty use a default label of ``n'', but this can be changed in the configuration. If /etc/gettydefs itself is missing, there is one entry built into the command which brings up a terminal at 300 (configuration parameter in mgetty) baud. It is strongly recommended that after making or modifying /etc/gettydefs, it be run through getty with the check option to be sure there are no errors. EXAMPLES
The following two lines show an example of 300/1200 baud toggle, which is useful for dial-up ports: 1200# B1200 HUPCL # B1200 SANE IXANY TAB3 #login: #300 300# B300 HUPCL # B300 SANE IXANY TAB3 #login: #1200 The following line shows a typical 9600 baud entry for a hard-wired connection (not currently supported for mgetty): 9600# B9600 # B9600 SANE IXANY IXANY ECHOE TAB3 #login: #9600 The following line is a typical smart-modem setup, suitable for mgetty: 19200mg# B19200 # B19200 SANE VERASE  VINTR 03 HUPCL # D T N Users @!login: #19200mg FILES
/etc/gettydefs SEE ALSO
mgetty(8), getty(8), login(1), ioctl(2), termio(7), termios(7). greenie 4 Dec 93 mgettydefs(4)
All times are GMT -4. The time now is 05:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy