What is an awk command to print only fields with a number in it?? [...]
It would be more than just a command. Why does it have to be AWK, have you been working on it with AWK, already? What have you tried? Where are you having problems with?
In addition to showing us what you have tried to solve your problem, please also explain in more detail why most alphabetic fields are deleted, but one of the alphabetic fields at the end of the 3rd input line (2nd output line) in your samples was converted to an empty field (with the trailing comma)???
What should happen if there is a leading alphabetic field in your input file followed by a field that contains a numeric character. Should there be a leading comma in the output or not?
I have the following awk script that I am using to find the max value in the file and print results.
awk 'BEGIN {MAX=-1E100} {for (x=2; x<=NF; x++) if ($x>MAX) {MAX = $x; C1 = $1}} END {print substr(C1,1,11), substr(C1,13,4), substr(C1,18,2), MAX}' ABC*
Input (ABC*)
... (6 Replies)
Hi
I want to use awk to match where field 3 contains a number within string - then print the line and just the number as a new field.
The source file is pipe delimited and looks something like
1|net|ABC Letr1|1530|||
1|net|EXP_1040 ABC|1121|||
1|net|EXP_TG1224|1122|||
1|net|R_North|1123|||... (5 Replies)
I have a string with the following information and want to return the number of entries enclosed by <> in awk
<stdin>: N = 441 <0.369000018/0.569000006> <0.369000018/0.569000006> <0/1> (7 Replies)
Hi,
I have a pipe delimited file. There are around 700 columns in the file.
The 65th column has carriage return which is causing read issue with our ETL process. I would like to replace the new line characters in 65th field with "nothing"
i have return the following code and need help to... (7 Replies)
I need an awk script that returns the 1st field of the line in the middle of a file. For example, if a file I have has 6 lines, I want it to return the 1st field on line number 3. If a file has 7 lines, I want the script to return the 1st field on line number 4.
File1:
3 214
4 219
5 226
2... (8 Replies)
Hi,
I'm trying to compare the value in a field to the value in a variable using awk. This works:
awk '$7 == "101"'but this is what I want (and it doesn't work):
value=101
awk '$7 == "$value"'
Any help or insight on this would be great. Thanks in advance. (1 Reply)
Hello there.
I want some help with awk
I have this script that reads a file from awk and you can insert from keyboard any list from the fields that exist so to be printed on monitor
echo "give a choice"
read -a ans
array=${ans}
awk -F: -v k="$array" '{
... (4 Replies)
Hello,
I have to compare two files file1 and file2, retrieve the number of lines modified (added, deleted or modified) in file2. Output must be like:
File2:
Added Deleted Changed Total
------ ------- -------- -----
2 1 1 4
Somebody... (2 Replies)
i have a several million line file like this:
M:charitygeneral:water:fairbanks:charitygeneral
field 2 and field 5 are the same
i want to read the file and rot13 or any caesar cipher field 2 and replace the with a random number 1 - 9
anyone know how to do this?
something slightly... (8 Replies)
Hi,
I have a various files;each filled with hundreds of line with similar number of fields.
I would like to extract out field $5 from each of this file and aggregate them before printing out to a file.
I tried to :-
#!/usr/bin/awk -f
file="file1.txt file2.txt file3.txt file4.txt"
... (1 Reply)