Search Results

Search: Posts Made By: neutronscott
1,472
Posted By neutronscott
something like: awk -F\| '!a[$1]++ {...
something like:


awk -F\| '!a[$1]++ { print $1 > "dis_col1.txt"; } !b[$2]++ { print $2 > "dis_col2.txt"; } END { print NR; }' file
2,804
Posted By neutronscott
Try: openssl s_client -connect myservice.com:443...
Try: openssl s_client -connect myservice.com:443 to do SSL connection.
Forum: OS X (Apple) 09-11-2017
71,328
Posted By neutronscott
mute@zbox:~$ type time time is a shell keyword ...
mute@zbox:~$ type time
time is a shell keyword
mute@zbox:~$ dash
$ type time
time is /usr/bin/time


Look at dash manual. It doesn't provide a time. bash has a built-in time, so it can time...
Forum: Linux 09-03-2017
3,800
Posted By neutronscott
Previously how? Different CentOS version? This...
Previously how? Different CentOS version? This machine is the router?
937
Posted By neutronscott
mute@zbox:~$ sed '/\r$/{N;s/\r\n//}' 4_test.csv ...
mute@zbox:~$ sed '/\r$/{N;s/\r\n//}' 4_test.csv
123456
7890AB


I'm usually an awk guy myself but this seemed worthy
3,775
Posted By neutronscott
"The Awk Programming Language" (Aho, Kernighan...
"The Awk Programming Language" (Aho, Kernighan and Weinberger, 1988) is still highly recommended by #awk on freenode IRC.
Forum: Solaris 01-05-2016
2,245
Posted By neutronscott
From the manual: Cmnd_Alias SHELLS =...
From the manual:


Cmnd_Alias SHELLS = /usr/bin/sh, /usr/bin/csh, /usr/bin/ksh,\
/usr/local/bin/tcsh, /usr/bin/rsh,\
/usr/local/bin/zsh

%wheel ALL = ALL, !SHELLS


This should help...
2,042
Posted By neutronscott
This at least works in GNU sed ...
This at least works in GNU sed


mute@tiny:~$ sed -n '/key1:/{s/key1: //;h};/^key2:/{H;x;s/\nkey2://p}' input
ABC DEF
GGG HHH


Place it in hold space. Append key2 to hold space, swap...
835
Posted By neutronscott
In this case the ^I was meant to be inserted by...
In this case the ^I was meant to be inserted by pressing the TAB key on your keyboard. The caret symbol often denotes a control code achieved by holding down control and pressing the next letter.
2,229
Posted By neutronscott
find "${dir:-.}" -type f -perm u+r | wc -l ...
find "${dir:-.}" -type f -perm u+r | wc -l


See Bash Reference Manual: Shell Parameter Expansion (http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameter-Expansion).
3,416
Posted By neutronscott
I'd make a helper function: in_array() {...
I'd make a helper function:


in_array() {
local n=$1 h

shift
for h; do
[[ $n = "$h" ]] && return
done

return 1
}

if in_array "$A" "${array[@]}"; then
...
3,772
Posted By neutronscott
See the following shell session example: ...
See the following shell session example:


mute@tiny:~$ mkdir shah9250
mute@tiny:~$ cd shah9250/
mute@tiny:~/shah9250$ touch 'file with spaces'
mute@tiny:~/shah9250$ for f in $(ls); do echo...
Forum: OS X (Apple) 08-20-2015
6,254
Posted By neutronscott
Don cheated!! Using same method, different...
Don cheated!!

Using same method, different interpreter:


mute@tiny:~$ time gawk -f ./square1 <<< $'90000000000\n4\n1'
90000000000 is the perfect square of 300000
4 is the perfect square of 2...
3,390
Posted By neutronscott
From the modules info, this uses the normal krb5...
From the modules info, this uses the normal krb5 libraries. From their manual:


Try that
2,127
Posted By neutronscott
The problem with max is the > and comparing...
The problem with max is the > and comparing strings to numbers.
The problem with min is we start with min being 0 and none of those are below zero.

Let's skip lines that don't have 2 columns, and...
Forum: Red Hat 07-28-2015
2,579
Posted By neutronscott
Compared to Red Hat Enterprise Linux 7 which is...
Compared to Red Hat Enterprise Linux 7 which is bleeding edge... :D
999
Posted By neutronscott
you read a variable called location and then use...
you read a variable called location and then use tests on store. Is this the whole script?

You also use ` ... ` inside of $( ... ). Both are for command substitution. Neither are necessary because...
2,037
Posted By neutronscott
A timer. Hardware interrupts are happening all...
A timer. Hardware interrupts are happening all the time which gives a vector for the kernel to regain control without programs cooperatively giving it up. Keyboard or network (as just two examples)...
1,713
Posted By neutronscott
you've a DOS formatted file then. first convert...
you've a DOS formatted file then. first convert it to unix, or amend the script like so:


awk '{sub(/\r$/,"")}NF {print "<p align=\"justify\"> " $0 " </p>"}' file.txt
2,485
Posted By neutronscott
oy. darn 1-index. Thanks, Don. but yes,...
oy. darn 1-index. Thanks, Don.

but yes, everything outputted by awk goes to cut. cut doesn't have logic like awk does. But awk can determine if it's an odd line and also skip the first 5...
2,485
Posted By neutronscott
Don't use cut. awk equivalent is substr($0,5,595)...
Don't use cut. awk equivalent is substr($0,5,595)

try:

awk '!(NR%2) { print substr($0,5,595); next; } 1' FWD-1.fas
1,402
Posted By neutronscott
That may be the most correct way but a quick way...
That may be the most correct way but a quick way to get the same output is to just append the new value and the field separator inside of $1.


mute@tiny:~$ awk 'NF<5{$1=$1 FS "XXX"}1' FS=, OFS=,...
2,895
Posted By neutronscott
FIELDWIDTHS seemed to only work on splitting....
FIELDWIDTHS seemed to only work on splitting. Then needed printf format specifiers to output them pretty again. This strips whitespace from beginning of all fields.


mute@tiny:~$ gawk -v...
1,193
Posted By neutronscott
I implied you needed to use ksh for that. It...
I implied you needed to use ksh for that. It should be your default shell, IMO, giving what SCO's documentation lists as available (ksh, csh, sh).

I don't have access to SCO but no sh should have...
1,414
Posted By neutronscott
zip stores paths relative to current directory....
zip stores paths relative to current directory. so one solution is to change the directory.


( cd /var/rt/on/mg/set/XM/Swor/xt && zip "$HOME/EM/ZIPData/All.zip" 0300* )
Showing results 1 to 25 of 280

 

Featured Tech Videos

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