Search Results

Search: Posts Made By: neutronscott
1,470
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: Linux 09-03-2017
3,799
Posted By neutronscott
Previously how? Different CentOS version? This...
Previously how? Different CentOS version? This machine is the router?
Forum: OS X (Apple) 09-11-2017
71,310
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...
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,773
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,040
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...
9,645
Posted By neutronscott
POSIX sh doesn't support that notation but often...
POSIX sh doesn't support that notation but often you can emulate it with short string using something like this:


$ v=substring
$ echo ${v:1:3}
sh: 2: Bad substitution
$ echo ${v%${v#???}}
sub
834
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,228
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,414
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,770
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,253
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,384
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,578
Posted By neutronscott
Compared to Red Hat Enterprise Linux 7 which is...
Compared to Red Hat Enterprise Linux 7 which is bleeding edge... :D
998
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,035
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)...
2,482
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...
1,709
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,482
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,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,400
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,893
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...
Showing results 1 to 25 of 280

 

Featured Tech Videos

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