Sponsored Content
Full Discussion: Help with Complex Awk.
Top Forums Shell Programming and Scripting Help with Complex Awk. Post 302712755 by pinnacle on Tuesday 9th of October 2012 04:35:38 PM
Old 10-09-2012
Help with Complex Awk.

Hi,
I have a file. In this file when ever the word "ABC" occurs at position from 25 and 34 I would like to replace
the value at postion 100 to 5 for the first 1000 rows only.

I have written the following Awk command.
Code:
 
nawk 'substr($0,25,9)=="ABC" {print $0}'  filename

The above command will not work properly as i am checking for ABC. But the length of the string i am checking is 9 characters.so the remaining will be spaces.
So I need to add some kind of trimming logic and also to figure out a way to track first 1000 records where the value is ABC and then replace the position 100 with value 5.


Help is appreciated.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Complex Sed/Awk Question?

Hello, So i have this file called /apps/turnout which looks like that of the contents of the /etc/shadow (but not exactly) the file has a long list in it. basically, the contents of this file looks something similar to the following: jajajajalala:D#$#AFVAdfda lalabavisof:#%R@fafla#$... (3 Replies)
Discussion started by: SkySmart
3 Replies

2. Shell Programming and Scripting

Complex use with awk

Hi , I have file named docs.txt The content of the file look like this: DOC disk location Size ======= ===== ============= ========= TXT A /dev/dm-1 10 TXT B /dev/dm-2 10 BIN C ... (3 Replies)
Discussion started by: yoavbe
3 Replies

3. Shell Programming and Scripting

Splitting a complex file using awk

I have a file that contains the following format delete from table1; delete from table2; insert into table1 (col1, col2) values (value1, value2)@ insert into table1 (col1, col2) values(value3, value4)@ insert into table2(col1, col2,col3) values(value1, value2, value3)@ etc etc This is... (9 Replies)
Discussion started by: hukcjv
9 Replies

4. Shell Programming and Scripting

Sorting complex file with awk

i have a file ddd.txt its delimiter is : but has , and "" within each column as below and also each line ends with ; I_EP,"29":I_US,"120":I_P_ID,"2020":I_NEW,"600":I_OLD,"400":I_POW,"4.5":I_NAME,"TOM";... (9 Replies)
Discussion started by: blackzinga80
9 Replies

5. Shell Programming and Scripting

complex Awk Question

Hi, I have a file look likes this : --->start hir Trace file: pudwh_ora_9998.trc Sort options: fchela exeela ***************************************************************count = number of times OCI procedure was executed cpu = cpu time in seconds executing elapsed = elapsed... (3 Replies)
Discussion started by: yoavbe
3 Replies

6. Shell Programming and Scripting

awk script (complex)

picked this up from another thread. echo 1st_file.csv; nawk -F, 'NR==FNR{a++;next} a{b++} END{for(i in b){if(b-1&&a!=b){print i";\t\t"b}else{print "NEW:"i";\t\t"b} } }' OFS=, 1st_file.csv *.csv | sort -r i need to use the above but with a slight modification.. 1.compare against 3 month... (25 Replies)
Discussion started by: slashbash
25 Replies

7. Shell Programming and Scripting

Complex transpose awk script

Hello to all in forum, Maybe an awk expert could help me with this complex task for me. I have the input shown below and I would like to get the output as follow: - I would like the output separated by commas. - The header is fixed and will be the same always. - For the lines containing... (22 Replies)
Discussion started by: Ophiuchus
22 Replies

8. Shell Programming and Scripting

Complex awk problem

hello, i have a complex awk problem... i have two tables, one with a value (0 to 1) and it's corresponding p-value, like this: 1. table: ______________________________ value p-value ... ... 0.254 0.003 0.245 0.005 0.233 0.006 ... ... ______________________________ and a... (6 Replies)
Discussion started by: dietmar13
6 Replies

9. Shell Programming and Scripting

Building a complex xml using awk

Hi I have a complex xml to be build using awk using a lookup file values. Below is the xml <country name="xyz"> <state name="abc"> <city name="qwe" capital="yes"/> <city name="asd" capital="no"/> </state> <state name="qrq"> <city name="rthy" capital="yes"/> <state> </country> ... (1 Reply)
Discussion started by: Nevergivup
1 Replies

10. Shell Programming and Scripting

awk in complex number data

Hi, I'm trying to transform my data from the following format: eps:, 0.248281687841641, -2.83539034165844e-7, 2.78042576353472+6.3505226053266e-6i to this: eps:, 0.248281687841641, -2.83539034165844e-7, 2.78042576353472, +6.3505226053266e-6 so I can plot it with GnuPlot. how do I... (4 Replies)
Discussion started by: rogeriogouvea
4 Replies
IFLASH2_MTD(4)						     Kernel Interfaces Manual						    IFLASH2_MTD(4)

NAME
iflash2_mtd - memory technology driver for Intel Series 2 flash SYNOPSIS
insmod iflash2_mtd.o [pc_debug=n] [mem_speed=n] [word_width=n] [vpp_timeout_period=n] [vpp_settle=n] [erase_timeout=n] [erase_limit=n] [retry_limit=n] [max_tries=n] [mem_speed=n] [word_width=n] DESCRIPTION
Iflash2_mtd is a memory technology driver for Intel Series 2 and Series 100 flash devices. Memory technology drivers are used by Card Ser- vices to provide device-independent access for memory cards through bulk memory services. Writing to Series 2 and Series 100 flash devices is very processor intensive. Individual words are written one at a time, at a speed of roughly 10 us per word. This busy period is too short to schedule other processes to run, so the driver will not yield the processor until an entire block is written. PARAMETERS
pc_debug=n Selects the PCMCIA debugging level. This parameter is only available if the module is compiled with debugging enabled. A non-zero value enables debugging. mem_speed=n Sets the access speed of shared memory windows, in nanoseconds. The default is 0 (i.e., no extra wait states). Values of up to 1000 are legal. word_width=n A flag indicating if memory windows should be configured for 8-bit (if 0) or 16-bit (if 1) transfers. The default is 1 (16-bit). vpp_timeout_period=n In milliseconds, this specifies the maximum idle period after a write operation before programming power will be switched off. The default is 1000 ms. vpp_settle=n In milliseconds, this gives a delay between when programming power is switched on, and when the device is assumed to be powered up and ready to receive erase or write commands. The default is 100 ms. erase_timeout=n In milliseconds, specifies the poll interval for monitoring the status of a bulk erase operation. The default is 100 ms. erase_limit=n In milliseconds, specifies the maximum elapsed time before an erase operation is assumed to have failed. The default is 10000 ms. retry_limit=n The maximum number of retries for a write operation. The default is 4. max_tries=n The maximum number of status register polls before a single word write is assumed to have timed out. The default is 4096. AUTHOR
David Hinds - dahinds@users.sourceforge.net SEE ALSO
iflash2+_mtd(4), memory_cs(4). pcmcia-cs 2000/06/12 21:24:48 IFLASH2_MTD(4)
All times are GMT -4. The time now is 06:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy