Search Results

Search: Posts Made By: jim mcnamara
114
Posted By jim mcnamara
I think you need to specify a field separator as...
I think you need to specify a field separator as a comma.


Owner@Owner-PC ~
$ awk -F, '!a[$1]++' filename
ENSG00000003137,ENST00000001146
ENSG00000003402,ENST00000309955


Owner@Owner-PC ~...
374
Posted By jim mcnamara
To sort dates it works best to convert them to...
To sort dates it works best to convert them to epoch seconds - the number of seconds since Jan 1 970. This code adds an epoch time sorts based on the epoch time, then prints the original minus the...
1,032
Posted By jim mcnamara
It is a shorthand character class that mostly...
It is a shorthand character class that mostly expands to [ \f\t\n\v] -- it is shorthand for a character class, like \d and others

Explained here:.

Regexp Tutorial - Shorthand Character...
1,073
Posted By jim mcnamara
Suppose you wanted to count the number of times...
Suppose you wanted to count the number of times the word of occurs in a file


Owner@Owner-PC ~
$ cat filename
all of the kings of Norway

Owner@Owner-PC ~
$ grep -Fo 'of' filename |wc -l
2
908
Posted By jim mcnamara
MicroFocus COBOL is your very best ORACLE option....
MicroFocus COBOL is your very best ORACLE option. It specializes in supporting ORACLE db's. It also is highly compatible with mainframe COBOL.
This will be the relatively easy part, moving code...
1,352
Posted By jim mcnamara
(3,0) A parenthesis is a reserved symbol in...
(3,0) A parenthesis is a reserved symbol in bash, not a string.
"(3,0)" Try making it a string...
1,253
Posted By jim mcnamara
Can you boot from installation software - DVD,...
Can you boot from installation software - DVD, thumb drive?
Boot to run-level 1 which makes the console root and allows no other logins.

Example with run-level 1 boot on linux with GRUB2
...
1,879
Posted By jim mcnamara
I was not clear. You thought your locale was...
I was not clear. You thought your locale was messed up somehow, so I started at the beginning to debug it.
Looks okay. Next, tr has problems with equivlence classes

[aªáàâãäå]

This is the...
1,687
Posted By jim mcnamara
This standard library call: nftw (or ftw) IBM...
This standard library call: nftw (or ftw)
IBM Knowledge Center (https://www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.bpxbd00/rnftw.htm)

supports the find command traversing...
1,160
Posted By jim mcnamara
In bash on some systems it is a shell function: ...
In bash on some systems it is a shell function:

realpath () ...
Forum: Programming 11-12-2019
3,596
Posted By jim mcnamara
The problem relates to memory management. The OS...
The problem relates to memory management. The OS sets an "end point" and a "start point" for a process working set (memory) when the process begins.

There are flavors of the malloc (also realloc)...
831
Posted By jim mcnamara
Your turn next: I got your awk code to run...
Your turn next:
I got your awk code to run against a dummy input file. I cannot see why your sample ran for you - however after fixing syntax I got an awk source file t.awk. t.lis is the file...
1,230
Posted By jim mcnamara
Plus, bash creates a subprocess (different from...
Plus, bash creates a subprocess (different from ksh) on the right side of a pipe, meaning any changes to variables in the statement on the right are not returned to the parent. This changed with...
546
Posted By jim mcnamara
what does ls -l sendmail.cf show? Has it...
what does ls -l sendmail.cf show? Has it changed recently? There should a default version of sendmail.mc you can compile and then substitute. If in doubt.

If it got changed you may want to...
3,220
Posted By jim mcnamara
Use bc if (( $(echo "$num1 > $num2" |bc -l)...
Use bc

if (( $(echo "$num1 > $num2" |bc -l) )); then
echo "ok"
fi


bc does floating point comparisons, in bash you have to surround it with (( )) to get a boolean (true/false) result.
1,011
Posted By jim mcnamara
Try export run=$1 to make the variable visible...
Try export run=$1 to make the variable visible in child processes. I can't see a mistake in the syntax.
3,168
Posted By jim mcnamara
Paul Hsieh's square root page has a bunch of...
Paul Hsieh's square root page has a bunch of square root algorithms including using Newton's method:

Paul Hsieh's Square Root page (http://www.azillionmonkeys.com/qed/sqroot.html)

I used to...
920
Posted By jim mcnamara
The command connects to a remote server, does and...
The command connects to a remote server, does and ls -l of a directory, which list files in the directory on the remote machine. The command is between the tic characters '

The output of the...
191
Posted By jim mcnamara
So removing "g" would then only replace the first...
So removing "g" would then only replace the first occurrence.
1,343
Posted By jim mcnamara
Corrected version awk -F "[/ \-]" '{ ...
Corrected version
awk -F "[/ \-]" '{
tmp=$(14)
gsub("[A-Z]{2}_[0-9]{4}_", "", tmp)
printf("%s %s-%s\n", $1, tmp, substr( $(15),1,...
1,343
Posted By jim mcnamara
This example is wrong, thanks Rudi See two posts...
This example is wrong, thanks Rudi See two posts down for a revised version, tried to use REGEX to simplify the code, does not accomplish much.
Using the sample
this code
awk -F "[/ \-]" '{
...
2,401
Posted By jim mcnamara
If the file names are the basis of comparison: ...
If the file names are the basis of comparison:

diff -r dir1 dir2 | grep dir1 | awk '{print $4}' > ~/mydiff

diff -r does a recursive comparison of directories and their subdirectories
Forum: What is on Your Mind? 09-07-2019
4,705
Posted By jim mcnamara
Hey! This is great. Welcome to the team. ...
Hey! This is great. Welcome to the team.


- jim
168
Posted By jim mcnamara
Also note that I do not see any difference...
Also note that I do not see any difference between your input and output examples. It is hard to help without an idea of what your tried. It also is extremely helpful for good answers to include...
1,882
Posted By jim mcnamara
By "append" your mean change the subject line - I...
By "append" your mean change the subject line - I think.
Let's tidy up the "script":

# Assume failure
code="FAIL"
# silently check the input file, if okay change the code
grep -q 'Return code...
Showing results 1 to 25 of 500

 

Featured Tech Videos

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