I need to convert every second line of the input starting from the first letter, then starting from the second letter, then the third, ..., and finally starting from the letter before the last one (according to the conversion table in the BEGIN section).
input:
in order to get this ouput:
I wanted to do that with 2 different approaches, just to be familiar with awk user-defined function and the function getline:
1) using an increment in a function called "convert(letter)" with only one argument, and use the result as a variable that I could use in the rest of the script. This is the topic I posted in a different thread:https://www.unix.com/unix-dummies-que...program-2.html
2) not using an increment in the function called "convert(letter, start)" with two arguments (the string to convert + the position to start), and redirect the results from the script to an output file. From this file I wanted to use the getline function to redirect it from the script and keep processing it. This is the topic of this thread.
But it appeared that none of these strategies work !!!
For the purpose of this thread I focused on using getline function (2nd strategy).
I tried:
The output I obtain with this code is messy (a mix between the original input with no FS, RS...)
Last edited by beca123456; 09-22-2012 at 10:18 PM..
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)
I am attempting to write a awk script that reads in a file after awk array elements are assigned and using those elements while reading in the new file. Does this make sense?
/pattern/ {tst=$3}
(( getline < "file" ) > 0 ) {
x=x " "tst
}
When I print tst in the END statement it... (9 Replies)
I was writing a awk function and had a error I was wondering about. It revolves around a Multidimensional array starting with ord
example:
if ( _e == 5 ) {
lmrb=$5 ; lmtb=$6 ; larb=$7 ;
latb=$8
}
... (2 Replies)
I have files that store multiple data points for the same device "vertically" and include multiple devices. It repeats a consistant pattern of lines where for each line:
Column 1 is a common number for the entire file and all devices in that file
Column 2 is a unique device number
Column 3 is... (7 Replies)
Hello,
I am working on solving an NP-Complete problem, so it is very important that operations and data with limited integer-argument ranges be computed using immutable look-up-tables contained entirely in CPU cache. Retrieval of the look-up-table data must never leave the CPU once initially... (6 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
HP rp5450 (L2000)
running HP-UX 11.11B
Using DLT 7000 and DLT 4000 tape drives for nightly full backups
Backup jobs created by SAM
DLT 7000 cron entry is as follows:
00 2 * * 1-6 /usr/sam/lbin/br_backup DLT FULL Y /dev/rmt/0m /var/sam/graphLCAa17036 root Y 1 N > /var/sam/SAM_br_msgs 2>&1... (1 Reply)
logs:
"/home/abc/public_html/index.php"
"/home/abc/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
how to use "cut" or "awk" or "sed" to get the following result:
abc
abc
xyz
xyz
xyz (8 Replies)