Search Results

Search: Posts Made By: keenboy100
81,396
Posted By keenboy100
Thanks Shamrock, I'm getting closer! My...
Thanks Shamrock, I'm getting closer!

My problem now is column 1 and 2 are separated by a space! If only I could use your solution and separate 1 and 2 as well and I'll be sorted.

I'll keep...
81,396
Posted By keenboy100
Sorry again! It's a weird file. Column 1 and...
Sorry again!

It's a weird file. Column 1 and 2 are separated by a space, 2 and 3 seem to separated by a tab (or 4 spaces)....

It's very inconsistent.

Would it be best replacing all white...
81,396
Posted By keenboy100
Hi, Sorry! The following sample is...
Hi,

Sorry!

The following sample is similar:


Col1 Col2 Col3 Col4

09:12:37 host2 OFFLINE host2 is offline and has been for 7 minutes...
81,396
Posted By keenboy100
awk - print columns with text and spaces
Hi,

I'm using awk to print columns from a tab delimited text file:


awk '{print " "$2" "$3" $6"}' file


The problem I have is column 6 contains text with spaces etc which means awk only...
1,347
Posted By keenboy100
Very cool.
Very cool.
1,347
Posted By keenboy100
Yoda For some reason it doesn't look like...
Yoda

For some reason it doesn't look like awk is looking to see if a line with ONLINE appears within 2 mins.

I can see that the code is printing R if T - P is less than 120 seconds but I'm a...
1,347
Posted By keenboy100
Thanks for the quick reply! Unfortunately...
Thanks for the quick reply!

Unfortunately that outputs the following:

09:40:43 HostA ONLINE
09:41:55 HostA ONLINE
09:42:26 HostD ONLINE
09:42:49 HostB ONLINE...
1,347
Posted By keenboy100
Printing from file with awk
Hi,

I'm trying to find an efficient way with awk to print the lines from a file which match the string 'OFFLINE' and DO NOT match the string ONLINE within 2 minutes from the date stamp in column...
3,222
Posted By keenboy100
Source File: ...
Source File:


mr,bob,bobson,Monday,20,france
mrs,caroline,godsom,Monday,30,Germany
mrs,sarah,bishop,Wednesday,10,UK
mr,karl,jacobs,Thursday,29,spain
mr,trevor,duell,Monday,34,belgium...
3,222
Posted By keenboy100
awk -F, '{$5==Monday}1' OFS=, file > newfile ...
awk -F, '{$5==Monday}1' OFS=, file > newfile

Doesn't seem to work. newfile just contains the same contents as file

Thanks,
3,222
Posted By keenboy100
AWK pattern matching
Hi,

How can I tell awk to print all lines/columns if column number 5 contains the word Monday?

I have tried


nawk -F, '$5==Monday' OFS=, myfile > outputfile


but that doesn't work (I am...
2,393
Posted By keenboy100
Works well thanks for your help.
Works well thanks for your help.
58,698
Posted By keenboy100
Thanks. My file has 15 columns and quite a...
Thanks.

My file has 15 columns and quite a few lines. I would like to round up the numbers of column 14 only. The other columns don't contain numbers.

The file is like this:

...
58,698
Posted By keenboy100
AWK rounding up numbers
Hi,

I have managed to round up numbers by using the following command:

echo "5.54" | awk '{printf "%.0f\n", $1}'

result

6

How can I round up all the numbers in a column in a file and...
2,393
Posted By keenboy100
How to split a file using AWK?
Hello,

I have a file like the following:

david,a,b,c,20,r
thomas,a,b,c,30,r
willaiam,a,b,c,80,r
barbara,a,b,c,100,r

I would like to split the file into other files using a condition for...
Showing results 1 to 15 of 15

 
All times are GMT -4. The time now is 02:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy