Skip to content
Advertisement

Tag: awk

AWK: variables not remembered outside actions?

I have a script that will give the percent of logins that are mine. This is done by matching all users, store to variable, then match me only (jdoe). I then use a basic operation to get the percent of logins that are mine. I get the error: ./loginPercent: line 13: eCount / totalCount: division by 0 (error token is

sed/awk to replace in a loop

I have a file called “demo” that has names in our DNS. I’m trying to loop through each line and replace the “names” with “names and ip address” (as a way of verifying dns queries) So far I have this but no luck on sed or awk command. Help appreciated. Thanks. demo “diggs” has an alias that yields one line

Finding emails from one file in another

I want to find emails from one file listed as such: in another file listed as so: and output the lines from the second file that match with the first file also keeping in mind it needs to match the entire email from start to finish so it won’t match robertjohn@blogs.com accidently. Desired output: Thanks! Answer With grep, get the

Faster solution to compare files in bash

file1: and file2: I need find match file2 in file1 and print whole file1 + second column of file2 So ouptut is: My solution is very slow in bash: I am prefer FASTER any bash or awk solution. Output can be modified, but need keep all the informations (order of column can be different). EDIT: Right now it looks like

Advertisement