Login or Register to Ask a Question and Join Our Community

Search Results

Search: Posts Made By: migurus
745
Posted By migurus
I see that you use wget, so consider --spider...
I see that you use wget, so consider --spider option.

you can say

wget -q --spider your-url-to-check-here
echo $?
0 means file exists, 1 means file does not exist
Forum: SCO 02-15-2017
5,757
Posted By migurus
the shebang line needs to be corrected, do not...
the shebang line needs to be corrected, do not place a space between exclamation mark and slash, type it like this

#!/bin/ksh
Forum: Programming 10-11-2016
1,366
Posted By migurus
I have to mention excellent books by Chris...
I have to mention excellent books by Chris Johnson, you can see great posts by the author in the Shell Scripting forum here. His site have huge number of very useful scripts:
Date functions by...
Forum: Ubuntu 09-09-2016
3,816
Posted By migurus
I followed advise to disable multithreading in...
I followed advise to disable multithreading in BIOS and it did help, system has been running for couple of weeks without any lockups.
3,643
Posted By migurus
I added the echo in the loop to show that when...
I added the echo in the loop to show that when nothing matches the N??? pattern the fn variable assumes value of N??? and that is the root of the question - when using for fname in some_pattern...
Forum: Programming 02-22-2016
2,309
Posted By migurus
I used this function for ages, don't even...
I used this function for ages, don't even remember its origin:

char *conv_to_zeroes_ones(void *in)
{
register int i, pos;
unsigned int *input;
char bit;
char ...
Forum: Programming 05-31-2015
3,274
Posted By migurus
I am not sure I got your requirements, I will...
I am not sure I got your requirements, I will just show few samples of string functions (SQL Server)

declare @str as varchar(128) = 'arr[hg19] 2q33.3q34(200,900,700-209,000,000)x2 xxx'
select...
Forum: Programming 04-06-2015
3,167
Posted By migurus
I think questioning how to read a set of data is...
I think questioning how to read a set of data is not exactly correct here. Rather, how to write those files. If you have an option to select in which way data will be given to you I'd much prefer...
3,416
Posted By migurus
I adjusted your original code to support N...
I adjusted your original code to support N counts/accumulators (a pair per each column). I use isnum function from Wikipedia


awk '
function isnum(x){
return(x==x+0);
}
{
...
7,003
Posted By migurus
Don uses string substitution feature of bash, you...
Don uses string substitution feature of bash, you can man bash and read all the details

To demonstrate:



$ a="123 abc # qwe"
$ echo ${a#*#}
qwe

$ a="123 abc + qwe"
$ echo...
Forum: Programming 10-16-2014
1,008
Posted By migurus
You are right, removing double quotes around...
You are right, removing double quotes around ${INCL} helped. Puzzle solved. Thank you!

I don't know how to tag it as solved.
9,997
Posted By migurus
The job started by a cron will have user's home...
The job started by a cron will have user's home directory as current directory, I'd guess when you run your commands from CLI your current directory is different; Try to add cd /your/target/dir;...
Forum: Programming 07-24-2014
1,011
Posted By migurus
When you have isql installed, to list tables just...
When you have isql installed, to list tables just type help and push <GO> button. Your question 2 is not clear. To query data you just type the query in the isql query area and hit <GO>, use <BLANK>...
13,191
Posted By migurus
I am sure sed is the tool to use, but just an...
I am sure sed is the tool to use, but just an idea - tr using character classes to delete al non-numerical characters, such as :

$ echo abc123 | tr -d [:alpha:]
123
$ echo abc123 | tr -d...
2,161
Posted By migurus
a sample script below will go through all csv...
a sample script below will go through all csv files in the current directory and rename files with current date:
#!/bin/ksh
today=$(date '+%Y%m%d');
for fname in *.csv; do
...
2,765
Posted By migurus
I like paste for this kind of merges: ...
I like paste for this kind of merges:


$ cat aa
1
line one
2
line two
3
line three
$ cat aa|paste - -
1 line one
2 line two
3 line three
Forum: Programming 01-16-2014
6,934
Posted By migurus
Make sure to follow proper usage of this...
Make sure to follow proper usage of this function, where on the first call the 1st argument should point to the input string, then on the following calls it should be NULL.
876
Posted By migurus
awk based solution $ cat test.sh awk '...
awk based solution

$ cat test.sh
awk '
{
if (NR == FNR) ### reading 1st file
### accumulate 2nd column values in array of key values
{
...
Forum: Programming 05-17-2013
1,909
Posted By migurus
Yes, you have to keep a variable wich keeps...
Yes, you have to keep a variable wich keeps number of elements in your array.

In many situations I find it convenient to hold ptr to array and counter together in one simple structure. If element...
Forum: Programming 10-30-2012
2,534
Posted By migurus
man find You will see it supports logical OR...
man find
You will see it supports logical OR and AND,
for example


find $DIRECTORY/$directoryname -name "*.jpg" -o -name "*.jpeg"
985
Posted By migurus
Using awk you can put pairs of records together...
Using awk you can put pairs of records together like this:


awk '{ if((NR%2) == 0) { ORS="\n"}else{ORS=" "} print}' your_file_name


This uses ORS (record separator for output) feature, for...
1,282
Posted By migurus
If your system has cron facility add a line to...
If your system has cron facility add a line to your crontab:

30 5 1 * * diff file1 file2 > results

This means run diff on given fies at 5:30 AM on 1st of each month and place output into file...
1,012
Posted By migurus
this script will summarize columns per first key...
this script will summarize columns per first key column;


awk '{ key[$1]=$1; col1[$1]+=$2; col2[$1]+=$3; col3[$1]+=$4; col4[$1]+=$5; }
END{ for(x in key) print x, col1[x], col2[x], col3[x],...
1,748
Posted By migurus
I'd like to point out a few useful keys I had...
I'd like to point out a few useful keys I had used when the connection was not stable
-t to specify retries
-c to continue download where it was aborted before
as example:
wget -c -t3 Security...
4,510
Posted By migurus
use declare -a as per bash manual For example,...
use declare -a as per bash manual
For example, here is a script that places first thre fields in three array elements

declare -a arr
while read arr[1] arr[2] arr[3];
do
echo...
Showing results 1 to 25 of 31

 

Featured Tech Videos