Search Results

Search: Posts Made By: treesloth
8,464
Posted By Yoda
awk -F, ' # if NF not equal to 7 ...
awk -F, '
# if NF not equal to 7
NF != 7 {
# If ORS not equal to " " set ORS = " " else set ORS = RS (newline by default)
ORS = ( ORS != " " ? " "...
18,626
Posted By MadeInGermany
and for the same reason, A[$1] alone defines an...
and for the same reason, A[$1] alone defines an (empty) element; no reason to assign a value to it =1.
18,626
Posted By Corona688
They're supposed to be efficient when you use...
They're supposed to be efficient when you use them like this. They're not straight arrays, they're some sort of hash or tree structure (implementation dependent).

You can get rid of the cat in...
4,067
Posted By bartus11
Try this then:printf "%.0f\n",...
Try this then:printf "%.0f\n", 2147483648
8,020
Posted By Corona688
I recently learned otherwise. Recent versions of...
I recently learned otherwise. Recent versions of mawk have borrowed this useful feature, possibly because some Linux distributions have taken to mawk as a faster substitute for GNU awk.
8,020
Posted By fpmurphy
mawk-20121129 is the latest version. You can...
mawk-20121129 is the latest version. You can download the sources and easily build it on CentOS 6.
8,020
Posted By alister
From the mawk changelog: 20121129 ... ...
From the mawk changelog:

20121129
...
+ add systime and mktime functions
...
+ integrate strtime function (patch by Dominic Letz).

Regards,
Alister
1,409
Posted By Corona688
It may count escape sequences as part of the...
It may count escape sequences as part of the string's length, and so assume it's longer than it actually is when printed.
3,589
Posted By MadeInGermany
Assumed your filename is "file". With sed: ...
Assumed your filename is "file".
With sed:
factor="3,6"
trial="YES,18,1.635"
sed '/'"$factor"'|/ s/$/|'"$trial"'/' < file > file.newWith the shell built-ins it becomes a bit long,
so a function...
3,589
Posted By Don Cragun
Unfortunately, both of these examples only work...
Unfortunately, both of these examples only work if all possible values of factor are in file before you try to add a new trial. If you want to start with an empty file and add new entries (as well...
1,461
Posted By agama
Using arrays would be one way: ...
Using arrays would be one way:


#!/usr/bin/env ksh
# add a value to the array
function add_value
{
typeset i=0

i=${#values[@]} # current length
if (( $i >=...
Forum: Cybersecurity 01-11-2012
2,370
Posted By jim mcnamara
try this:...
try this:...
3,629
Posted By yazu
There is a difference: % touch 0 1 2 3 %...
There is a difference:
% touch 0 1 2 3

% ls | awk 'x = $0 {print x}'
1
2
3

% ls | awk '{x = $0 ; print x}'
0
1
2
3

Assignment is an expression in awk. These two commands are the same...
3,629
Posted By alister
They are not identical. $printf '%s\n' 0 1...
They are not identical.

$printf '%s\n' 0 1 '' 'not empty' | awk '{x = $0; print x}
0
1

not empty
$printf '%s\n' 0 1 '' 'not empty' | awk 'x = $0 {print x}
1
not empty

In AWK, the value...
3,055
Posted By Corona688
It's because, when run with xargs, the commands...
It's because, when run with xargs, the commands have no standard input connected. Usually it'd wait for input, either from your end or the other end, but now it connects, tries to read from the...
3,055
Posted By binlib
It seems to have something to do with networking....
It seems to have something to do with networking. Try
seq 1 | xargs -I DISCARD telnet example.com 3334 |cat
Showing results 1 to 16 of 16

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