hi, i got several pieces of code that look like:
as u can see i'm invoking awk several times.. is there a faster way to do this? like invoking awk once and do the assignments with the changin parameters...
When you mention `awk 'NR=='$ff' {print $1}' p_walls.raw | cut -f1 -d ' '` (assuming FS is space for awk), I don't think cut -f1 -d' ' will have any effect. Or am I wrong?
Also, please provide a sample input and desired output.
This User Gave Thanks to balajesuri For This Post:
no it wont, sry, those cuts are indeed useless..i'm editing the question... but the point here is how to do a loop inside awk with the lines as parameters...
i see there are ways to loop inside awk... as for the input and output ..only the input matter atp, the input looks like:
thanks a lot, that's the sort of thing i'd usually do using matlab, but since i was using bash/sh i didnt have (or i havent found) this option.. the whole script has like several awk invokes and the estimated time to completion is 22 years! LOL, so i rly need to open files once... guess the perl is an option... i was hoping for an answer for bash/sh but it can move to perl
I need to pass values at runtime for the below awk command where
l is the length and partial.txt is the file name.
awk -v l=285 '{s="%-"l"s\n";printf(s,$0);}' partial.txt > temp1.txt; (5 Replies)
To fix an "issue" we're having I need to update SHMMAX from 1GB to 2Gb, it's a dynamic parameter so am just wondering how flexible it really is.
As Oracle is running on the server do I need to shut that down to change the parameter or will it just take the change on the fly?
Also how would I... (6 Replies)
Hello everyone!!
I need help with this please:
I have a file with this content:
56977964333 730030201857822 1
2
4
56976969284 730030201412442 1
2... (3 Replies)
Hi,
The below script is working fine
awk1.sh
=======
awk BEGIN { FS="|" } FNR==NR { f1=$2; next } $1 in f1 && $2 =="xx" && $1 == "DAILY_JOB" {print $3}
awk -f awk1.sh a.txt b.txt--Its working fine .
When passing parameters its not working .Any help it should be appereciated.
... (4 Replies)
Is there a way to preform check if the parameters that was send with the command awk -f `file_name.awk` `input_file` before even it gets to the BEGIN section (i have tested a try to check in the BEGIN it doesn't let ,you must make it on the section that after the BEGIN) and then decide if the... (1 Reply)
Hello,
How can I make an alias of an AWK one liner that prints specific lines from a file like below?
# from a command like this:
awk 'NR == 100, NR == 150' file.cfg
The alias I want to make should work like this(I guess):
<alias_command> <file.cfg><start_line><end_line>
So the... (1 Reply)
I have an awk file where I need to pass a filename and a value as a parameter from a sh script. I need to know how to pass those values in the sh script and how to use the same in the awk file.
Thanks in advance!!!
Geetha (3 Replies)
Hello
I've got a script that takes 2 parameters. id and f.
id is a user id and f is a file.
I want to print this id on the first line and then the file.
how can this be done?
thanks (3 Replies)
Hi
I have to change some TCP settings in Solaris10 machine running on AMD. Is there any tool or GUI to do this. I want to see if there is any easy way to put them in the startup scripts.
Thanks (1 Reply)