Sponsored Content
Top Forums Shell Programming and Scripting Replace several numbers with respective tag and make a single file Post 302462557 by frans on Thursday 14th of October 2010 12:57:55 PM
Old 10-14-2010
bash code:
  1. ERR=( Success Failure Fail Error3 Error4 Error5 Error6 Error7 Error8 Error9 Unknown Error11 Error12 Error13 Error14 Error15 Error16 )
  2. while IFS='|' read A B
  3. do
  4.    echo "$A|${ERR[$B]}|"
  5. done <file
result:
Code:
736645|Success|
13879|Failure|
495563|Unknown|
127933|Error14|
4975|Error16|
49038|Error6|
53560|Error7|
135115|Error8|
178857|Error9|

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

to replace one character by numbers in a file

suppose u have a file aas P-H 123 gdg O-U 223 hdy I-Y 12 fgd K-O 333 ssa L-P 32 output shud be like that aas P123H gdg O223U hdy I12Y fgd K333O ssa L32P thanks (7 Replies)
Discussion started by: cdfd123
7 Replies

2. AIX

How to replace many numbers with one number in a file

How to replace many numbers with one number in a file. Many numbers like 444565,454678,443298,etc. i want to replace these with one number (300).Please halp me out. (2 Replies)
Discussion started by: vpandey
2 Replies

3. Shell Programming and Scripting

Addition of all the numbers in a single file

Hi All , Want to know the "sum" of all the digits in below file called "/sample" .Could some one please let me know the script either command . cat /sample 12 34 23 23 Best Regards, Chinni . (5 Replies)
Discussion started by: chinni-script
5 Replies

4. Shell Programming and Scripting

Search for multiple string and replace with respective values

Hi, Can anyone help me to search for multiple strings within specified position and replace with respective string value. For example I need to search the string from the position 11 to 20 and if it contain ABC and then replace it by BCDEFGHIJ ... find AABZSDJIK and replace with QWE. and... (4 Replies)
Discussion started by: zooby
4 Replies

5. Shell Programming and Scripting

Find all .htaccess files and make a backup copy in respective directories

Hey guys, I need to know how to locate all .htaccess files on the server and make a backup of them in the folder they reside before I run a script to modify all of them. So basically taking dir1/.htaccess and copying it as dir1/.htaccess_bk dir2/.htaccess copying as dir2/.htaccess_bk... (5 Replies)
Discussion started by: boxx
5 Replies

6. Shell Programming and Scripting

find all numbers > x and replace with y within a file

How would I do this? How could i use <> symbols for numbers in the find/replace code below? perl -pi -e 's/test/tst/' OR is there a better way? 100 5000 2 432 4 2 33 4 5 6 65 300 301 needs to be: 100 300 2 300 4 2 33 4 5 6 65 300 300 also it might not always need spaces... i... (12 Replies)
Discussion started by: herot
12 Replies

7. Shell Programming and Scripting

How to make multiple small file out of a single file?

Hi, I have a file that consist of around six million line, now the task is to divide this file into 12 small file so that each file would have half a million lines in it. Thanks. (3 Replies)
Discussion started by: mukulverma2408
3 Replies

8. Shell Programming and Scripting

How to replace multiple "&nbsp;" entry with in <td> tag into single entry using sed?

I have the input file like this. Input file: 12.txt 1) There are one or more than one <tr> tags in same line. 2) Some tr tags may have one <td> or more tna one <td> tags within it. 3) Few <td> tags having "<td> &nbsp; </td>". Few having more than one "&nbsp;" entry in it. <tr> some td... (4 Replies)
Discussion started by: thomasraj87
4 Replies

9. Shell Programming and Scripting

Use awk to replace numbers in a file with a column from another file

Hello, I am trying to make a awk code that will take 2 files, a txt file like this : 1 1 88 c(1:38, 42, 102) 2 2 128 c(39:41, 43:101, 103:105, 153, 155:189, 292, 344:369) 3 3 84 c(190:249, 603, 606:607, 609:629) 4 4 12 ... (8 Replies)
Discussion started by: nastaziales
8 Replies

10. UNIX for Beginners Questions & Answers

Display multiple words into a single td tag

awk 'BEGIN{print "<table>"} {print "<tr>"; for ( i=1;i<NF;i++) print " <td>" $I "</td>"; print "</tr>"} END{print " </table>"}' <file name > (6 Replies)
Discussion started by: Himanshu1
6 Replies
get_wch(3XCURSES)					  X/Open Curses Library Functions					 get_wch(3XCURSES)

NAME
get_wch, wget_wch, mvget_wch, mvwget_wch - get a wide character from terminal SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib -R /usr/xpg4/lib -lcurses [ library... ] c89 [ flag... ] file... -lcurses [ library... ] #include <curses.h> int get_wch(wint_t *ch); int wget_wch(WINDOW *win, wint_t *ch); int mvget_wch(int y, int x, wint_t *ch); int mvwget_wch(WINDOW *win, int y, int x, wint_t *ch); DESCRIPTION
The get_wch() and wget_wch() functions get a wide character from the terminal associated with the window stdscr or window win, respec- tively. The mvget_wch() and mvwget_wch() functions move the cursor to the position specified in stdscr or win, respectively, then get a character. If the window is not a pad and has been changed since the last call to refresh(3XCURSES), get_wch() calls refresh() to update the window before the next character is read. The setting of certain functions affects the behavior of the get_wch() set of functions. For example, if cbreak(3XCURSES) is set, charac- ters typed by the user are immediately processed. If halfdelay(3XCURSES) is set, get_wch() waits until a character is typed or returns ERR if no character is typed within the specified timeout period. This timeout can also be specified for individual windows with the delay parameter of timeout(3XCURSES) A negative value waits for input; a value of 0 returns ERR if no input is ready; a positive value blocks until input arrives or the time specified expires (in which case ERR is returned). If nodelay(3XCURSES) is set, ERR is returned if no input is waiting; if not set, get_wch() waits until input arrives. Each character will be echoed to the window unless noecho(3XCURSES) has been set. If keypad handling is enabled ( keypad(3XCURSES) is TRUE), the token for the function key (a KEY_ value) is stored in the object pointed to by ch and KEY_CODE_YES is returned. If a character is received that could be the beginning of a function key (for example, ESC), an inter- byte timer is set. If the remainder of the sequence is not received before the time expires, the character is passed through; otherwise, the value of the function key is returned. If notimeout() is set, the inter-byte timer is not used. The ESC key is typically a prefix key used with function keys and should not be used as a single character. See the getch(3XCURSES) manual page for a list of tokens for function keys that are returned by the get_wch() set of functions if keypad handling is enabled (Some terminals may not support all tokens). PARAMETERS
ch Is a pointer to a wide integer where the returned wide character or KEY_ value can be stored. win Is a pointer to the window associated with the terminal from which the character is to be read. y Is the y (row) coordinate for the position of the character to be read. x Is the x (column) coordinate for the position of the character to be read. RETURN VALUES
When these functions successfully report the pressing of a function key, they return KEY_CODE_YES. When they successfully report a wide character, they return OK. Otherwise, they return ERR. ERRORS
None. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
cbreak(3XCURSES), echo(3XCURSES), halfdelay(3XCURSES), keypad(3XCURSES), libcurses(3XCURSES), nodelay(3XCURSES), notimeout(3XCURSES), raw(3XCURSES), timeout(3XCURSES), attributes(5), standards(5) SunOS 5.11 5 Jun 2002 get_wch(3XCURSES)
All times are GMT -4. The time now is 08:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy