46 Topics

Member Avatar for
Member Avatar for cored0mp

Team, What would you want to see in an awk tutorial? None of the existing tutorials are great. A good tutorial is like the video from ten years ago where that kid outlines in about ten minutes how to breakdance, it's crazy.

2
55
Member Avatar for nikita.

Hi, i want to delete a column from a file. the file is like : 1|2|3|4|5|6|7|8|9|0 1|2|3|4|5|6|7|8|9|0 1|2|3|4|5|6|7|8|9|0 1|2|3|4|5|6|7|8|9|0 1|2|3|4|5|6|7|8|9|0 1|2|3|4|5|6|7|8|9|0 if i want to remove any column the outout should be like ( suppose 4): 1|2|3|5|6|7|8|9|0 1|2|3|5|6|7|8|9|0 1|2|3|5|6|7|8|9|0 1|2|3|5|6|7|8|9|0 1|2|3|5|6|7|8|9|0 1|2|3|5|6|7|8|9|0 i have used swk command, but its not …

Member Avatar for Liam Huang
0
2K
Member Avatar for clife

Hi , I would like to monitor upload and download datas of devices connected to the router. I am using the following iptables rules: sudo iptables -N DMon sudo iptables -A FORWARD sudo iptables -A FORWARD -d 70.70.70.1/26 -j DMon sudo iptables -A DMon -d 70.70.70.50 sudo iptables -A FORWARD …

Member Avatar for clife
0
345
Member Avatar for Gurjit_1

Hi guys , i have found command to extract the output of a command and save it in a file. But I want whenever I extract the data from a command , it should start from a particular line ? I am using this command below to extract data of …

Member Avatar for Rambino
0
237
Member Avatar for toldav

Hi Guys, I'm new to awk and trying to format an stadout "temp.txt" to csv format so I can export to excel. I'm having issues here is my code so far..If any one can help to see the light!!! The ### sign is the second server on the list each …

Member Avatar for thekashyap
0
245
Member Avatar for Bhargav_2

Hi Can anyone help me out in this. Actually, I have rows like **Bold Text Here** 50121 abc.com 28/1/2014-12:00:00 52111 xyz.com 27/1/2014-12:00:00 deusr abc.com 26/1/2014-12:00:00 50121 abc.com 26/1/2014-12:00:00 52111 abc.com 25/1/2014-12:00:00 I removed the duplicates based on first column and got the output as 50121 abc.com 28/1/2014-12:00:00 52111 xyz.com 27/1/2014-12:00:00 …

Member Avatar for rch1231
0
145
Member Avatar for William_6

hello, I created a awk program to work witha data file to output a table and subtotal the rows and total up the collums and average I got it to work but when i added a presentation header before my totals go away. working code so far ------ can be …

Member Avatar for William_6
0
237
Member Avatar for sudipta.mml

Hi All, I have a problem to extract data from a text file. My file looks like *KEYWORD 10. 30. 50. 40. 50. 60. 0. 15. 25. llllllll KEYWORD 11. 31. 50. 40. 51. 60. 0. 15. 26. llllllll* My aim is to extract second datapoint by using first keyword. …

Member Avatar for Unimportant
0
117
Member Avatar for mossman mudas

i have an awk script and in the end section i create my table data with printf and i want to sort it so i used pipe then sort i am calling it like this awk -f awkscript file in bash i can get it to work the way i …

Member Avatar for mossman mudas
0
248
Member Avatar for lockdon

I want to use awk to strip certain fields from the output of the Dell OMSA storage hardware diag tool. Typically the format of the output is: ID : 0:0:11 Status : Ok Name : Physical Disk 0:0:11 State : Online Power Status : Spun Up Bus Protocol : SAS …

Member Avatar for Watael
0
136
Member Avatar for uvray90

BEGIN { via["AIRTEL_WHITE"] = 0 via["AIRTEL_WAP"] = 0 via["_321_44"] = 0 via["_321_555"] = 0 count=0 } { for(var in via) { if($5 ~ /var/) { count++ via[var] = via[var]++; } #print $5 } } END{ for(var in via) { if(via[var] != 0) { print var "->" via[var] } } print …

Member Avatar for uvray90
0
238
Member Avatar for navneet.sinha.505

help me to shorten this awk code.I m newbie for this language. {if(NR>1){z=0;x=$1;while(x){z+=x/(x^4+x^2+1);x--;}printf"%.5f\n",z;}}

0
47
Member Avatar for amrita111

Hello..I am learning awk and tcl languages..I want to ask how can we integrate awk code in tcl file??? can we do this or we have to open call awk file from tcl???Reply soon.

Member Avatar for TrustyTony
0
152
Member Avatar for maurya10
Member Avatar for manpreet87

Hi, Each line of file contains a timestamp value(ex: 2012-01-16 14:43:23) which denotes the time at which a particular action was performed. I want to extract the logs for all the actions performed in the last 2 hours using awk. That is, where timestamp should greater currentTime - 2 hours …

Member Avatar for L7Sqr
0
125
Member Avatar for gcclinux

Hello, I was wondering if you can help me, I am tryin gto achieve a specif output and I am stuck, any help would be greatly appreciated. [CODE]# cat file 1,2,3,4,5,6 1,,3,4,5,6 1,2,,,,6 # cat file | awk -F, '{print $1,$2,$3,$4,$5,$6}' | awk '{printf("%-1s %2s %2s %2s %2s %2s\n", $1, …

Member Avatar for Fest3er
0
174
Member Avatar for Member24

Hi, I recently started working using awk. I am facing a problem to traverse a file row by row. I have a file test.txt which has 2 fields filename and action. test.txt -------- /tmp/a.txt|Action1 /tmp/b.txt|Action2 /tmp/c.txt|Action3 I need to check for the existence of file ($1) in the above file, …

Member Avatar for JeoSaurus
0
254
Member Avatar for ajwest85

Im using awk script programming in the END state if i set the for loop i in name it would print out the values of the name array but not the sales array, If i set the for loop i in sales it would print out the values in the …

Member Avatar for thekashyap
0
155
Member Avatar for fatalaccidents

Hey guys, So I have a file with a bunch of information with the first line being the julian date. I'm wanting to copy all of the information of the julian date (which there are 288 lines per julian date from readings every fifteen minutes) and copy them and add …

0
68
Member Avatar for linux.buzz

Hi all, I got stuck into a problem. I have a variable in which the data is stored as below: variable_test=0m0.001s 0m0.001s 0m0.001s 0m0.001s 0m0.001s 0m0.001s .....an so on. There are lots of values in format like "3m1.057s" are stored in variable_test separated with an space between two such values. …

Member Avatar for cfajohnson
0
153
Member Avatar for Newbi1984

Hi Daniweb members, I have two files that are not of equal dimensions and I need to match them on a unique key much like an SQL natural join. The files are space delimited and contain no headings. File 1 rs121 10001 A G rs125 10002 C T rs126 10003 …

Member Avatar for nezachem
0
943
Member Avatar for oceantech

Hi all! I have a directory with multiple text files of data. I have been trying to develop a loop to read through all the files, eliminate the first 88 lines (text header) and create a new file with only the data values. I have been all to write the …

Member Avatar for griswolf
0
123
Member Avatar for spowel4
Member Avatar for S1GNZ

Hi all, I hope I could get some help with AWK. What I need to achieve is counting all domains in an e-mail log file. The values are in field 7 ($7), and I need to count each domain separately. This is what I have so far: [B]awk '$7=/@./ {som …

Member Avatar for Salem
0
104
Member Avatar for LadyAnne

Hello I am trying to compare 2 files using awk. They have the same seperators, same columns, same rows. I need to go through both and see at which line they differ, adn then save those differences to another file. I have tried many methods but none seem to work. …

Member Avatar for LadyAnne
0
973
Member Avatar for railmaster7

I'm having trouble with some syntax errors, and also wanted to get an opinion of what I've written will work as needed. I'm writing an awk report script to organize data from a file and calculate the amount of sales. There are 3 kinds of lines that we will need …

0
70
Member Avatar for Gerbilkit

Alright I admit, I hate AWK. Heck even my C++ class is making more sense at the moment. I have a strong suspicion that this is a language I will learn and never use again after this class, as everything else seems better/more intuitive. But maybe that's just me. I'm …

Member Avatar for Aia
0
122
Member Avatar for axeeffect2002

Hi, I am trying to log a portion of the log file depending upon the "WorkOrderNumber" and "level". The shell script i've written is as follows:- [CODE]cat input.log | awk '/\[WorkOrderNumber/' | awk /120600012/ | awk /INFO/ | tee log.vw[/CODE] For a particular WorkOrderNumber, the record is very long (4253 …

Member Avatar for axeeffect2002
-1
420
Member Avatar for Bhoot

i have come across a question which asks to write an awk command that displays all records having 2nd and 3rd characters same. i could write the solution in sed, using tagged regular expression, as follows : [QUOTE] sed -n '/^.\(.\)\1.*$/' emp.list [/QUOTE] However, as far as i know, tagged …

Member Avatar for ghostdog74
0
304
Member Avatar for chris5126

hi, i am totally stuck i need a script (that works in ksh under solaris 10) that takes the following output [code] d15 509MB c1t0d0s5 d13 7.0GB c1t0d0s3 d11 1.5GB c1t0d0s1 d10 10GB c1t0d0s0 d25 509MB c1t1d0s5 d23 7.0GB c1t1d0s3 d21 1.5GB c1t1d0s1 d20 10GB c1t1d0s0 [/code] and for the …

Member Avatar for Aia
0
259
Member Avatar for snahata

Hi, I would like to add a new column in a text file which contains values based on the value of another column. Eg: suppose the text file contains: 1 abc 67 2 def 40 3 uty 57 ....... .... Now i would like to add a new column which …

Member Avatar for ghostdog74
0
412
Member Avatar for manuswami

Hi, I have this belowmentioned file: col1 col2 10 50 20 60 30 70 40 80 I have to take the O/P as col1 col2 col3 10 50 60 20 60 80 30 70 100 40 80 120 Using awk how can i get the above output as the col3 …

Member Avatar for Salem
0
73
Member Avatar for jedi_ralf

I am new to awk, so please excuse any mistakes. I was hoping someone would be able to tell me if it's possible to include variables in a regular expression, and if so, how. The code I currently have is the find the beginning of link (<a) and image (<img) …

Member Avatar for jedi_ralf
0
252
Member Avatar for ashikin_8119

Hi all; I have a file that i need to sort and batch with certain criterias. For every 5 lines that meet the criteria i need to add '1' above it to separate it with other batch. The original file look like this: 20080201A300000357701 80058+117.06 02 20080201A300000357701 80058-117.06 02 20080201A300000382309 …

0
58
Member Avatar for xthexonex

Hello all! I am fairly new to linux. I am using fedora7 bash. I am using an awk statement to extract several fields from a file and assign them to variables within awk. With some fields in that file and some variables made within awk i would like to use …

Member Avatar for ghostdog74
0
113
Member Avatar for ashikin_8119

Hi all,i am very new to shell and awk scripting,..hope u guys can help... I need help in sorting and grouping the data in one flat file.The file look like this: 040171011140820070000000009650244002933170003000000075272 1F921338300506 01082007000014000000027665 1H912279980109 01082007000012000000042420 1S503377200110 01082007000014000000005187 1S503377200110 01082007000688000000005188 3SF98 I need to rearrange the file to become like …

Member Avatar for ashikin_8119
0
107
Member Avatar for sgentry6

This is probably just due to my quotes, but I'm trying to get the following script up and running: This is my command line: find ./ -type f | xargs grep "#include <some.h>" | awk -F: '{print $1}' | xargs grep "#include <another.h>" I'm trying to find a nested header …

Member Avatar for Infarction
0
152
Member Avatar for ShaneUniStudent

Hey guys, i am about to throw it all in because i just cannot get this to work :S. All i wanted to do is search through a file and find a string and replace with an argument from the command line. So basically i have a file which has …

Member Avatar for ghostdog74
0
212
Member Avatar for ahan

Hi, I have to manipulate a data file which say reads like this {$index $value $error_on_value} aa 4.56 0.7 bb 123.456 0.00987 cc 987654 321 . . in easily human readable format of type aa 4.6(7) bb 123.456(1) cc 9.877(3)e+05 value rounded to 4.6 with error of 0.7 on the …

Member Avatar for abhinav_shah
0
244
Member Avatar for fili00

hey, i didn't find where to post my problem in the forum so I try it this way. I just wanted to know how I can print out with awk or others only one line and not a whole column what is made by print$1. I have a data which …

Member Avatar for DMR
0
90
Member Avatar for systest

I am trying to find out how to stream a file so that if gives me back how many times a certain field label occurred. File example: Cat black 100 home lost Dog brown 632 street lost Dog black 839 home owned Pig pink 123 mud farm Dog white 345 …

Member Avatar for perniciosus
0
96
Member Avatar for altheastronut

I was told awk is great for working with columns of data. From what I have seen it's pretty cool, but I haven't found a good site that shows useful (to me) commands. What I'm looking for are the commands that print out lines 5-10 or lines 30-70. The closest …

Member Avatar for jim mcnamara
0
182
Member Avatar for MBMorrow

Hi, I recently wrote a text version of the old DOS Artillery Duel or Atari's Cannon Duel game. In this version, you play against the computer and can control the projectile's angle and velocity. I'd now like to add one more dimension whereby the height of the cannons randomly changes …

Member Avatar for MBMorrow
0
109
Member Avatar for nwc

Can anyone give me a one-liner that adds a timestamp to the output of vmstat -n 1 Perhaps using awk?

Member Avatar for gritty
0
292
Member Avatar for rhnaeco

I am trying to use Simpson's Law to find the area in some profiles i have and i'd like to do this in a in a shell script as this how the data has been created. an example of the file ( without the brackets): (1) (2) (a) 12.146 -0.65 …

0
71
Member Avatar for ShaneUniStudent

Hey guys, i am a noobie and i am after some very much anticipated help. I currently attend uni and working on a project for a subject called unix based engineering. The basic problem is; I have an input file and this input file contains a series of MOSFET parameters …

0
91

The End.