Search Results

Search: Posts Made By: Scrutinizer
Forum: Programming 8 Hours Ago
59
Posted By Scrutinizer
According to : Pandas' api reference...
According to : Pandas' api reference (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html)

pandas.read_csv returns
DataFrame or TextParser
A comma-separated values...
156
Posted By Scrutinizer
Slightly more "traditional" way of doing this: ...
Slightly more "traditional" way of doing this:

for (( i=0; i<${#L1[@]}; i++ ))
do
printf "%s %s\n" "${L1[i]}" "${L2[i%${#L2[@]}]}"
done

or
lenL1=${#L1[@]} lenL2=${#L2[@]}
for (( i=0;...
585
Posted By Scrutinizer
Pertaining to post #1: Try: join -12 -22 -o...
Pertaining to post #1: Try:
join -12 -22 -o 1.1,2.1 <(xargs -n1 <file1) <(xargs -n1 <file2)
426
Posted By Scrutinizer
Try converting the input file to UNIX format...
Try converting the input file to UNIX format first.
It appears to be in Windows format
tr -d '\r' <file >newfile


--
or you can maybe use
dos2unix file
if available on your OS.
Forum: Shell Programming and Scripting 2 Weeks Ago
371
Posted By Scrutinizer
Hi, try double quotes: sed...
Hi, try double quotes:
sed "s/${TOKEN1}\(.*\)${TOKEN2}.*/\1/" "$INPUT1"
The curly braces for variable expansions are good practice within strings, for reasons of readability and also to prevent...
426
Posted By Scrutinizer
You would need to compare $5 and $6 to all the...
You would need to compare $5 and $6 to all the ranges in $2, $3 so you would need to put them in memory first, so a way to do it would be to read the inputfile twice, the first time to put $2, $3 in...
446
Posted By Scrutinizer
Try: sed 's/[^ ]*_\(....\)\./\1 &/' file ...
Try:
sed 's/[^ ]*_\(....\)\./\1 &/' file
-rw-r--r-- 1 360 600 94255 Jan 01 11:16 2020 file1_2020.csv
-rw-r--r-- 1 360 600 114573 Dec 29 11:10 2019 file2_2019.csv...
Forum: Shell Programming and Scripting 2 Weeks Ago
474
Posted By Scrutinizer
POSIX regular expressions (BRE/ERE) and the GNU...
POSIX regular expressions (BRE/ERE) and the GNU and BSD derivatives are the exception, rather than the norm, in that \ is not special/meta within a character class (bracket) expression.

In (I...
Forum: Shell Programming and Scripting 2 Weeks Ago
714
Posted By Scrutinizer
One could also use quotes: ...
One could also use quotes:
AnzahlUeberstunden="$(date -d "$JAHR-$MONAT-$TAG $ArbeitEnde" +%s) - $(date -d "$JAHR-$MONAT-$TAG $NormalesArbeitsEnde" +%s)"
AnzahlUeberstunden='AnzahlUeberstunden / 60'
Forum: Shell Programming and Scripting 3 Weeks Ago
714
Posted By Scrutinizer
Because it is a an arithmetic operation (you are...
Because it is a an arithmetic operation (you are trying to divide a number by 60)

Therefore you need an arithmetic expansion ( see: Shell command language: arithmetic expansions...
Forum: Shell Programming and Scripting 3 Weeks Ago
714
Posted By Scrutinizer
Try the same as de line above with $(( ... )) en...
Try the same as de line above with $(( ... )) en some corrections in the variable name..
AnzahlUeberstunden=$((AnzahlUeberstunden/60))
or
(( AnzahlUeberstunden/=60 ))
555
Posted By Scrutinizer
Then you can disregard the stuff about older...
Then you can disregard the stuff about older Linux versions, so check the difference between "free memory" and "available memory", plus the remarks by Neo and I about numerical comparisons..
701
Posted By Scrutinizer
Hi Ravinder, As long as a mv operation is...
Hi Ravinder,

As long as a mv operation is performed on the same file system - as is the case here - that should not pose a problem, since mv then only manipulates directory data: A file name is...
555
Posted By Scrutinizer
What Linux version are you using? Check the...
What Linux version are you using?
Check the difference between free memory and available memory.

With older Linux versions check the -/+ buffers/cache: line.

The buffers/cache/slab memory...
701
Posted By Scrutinizer
Note: -n (no clobber) for the mv command is...
Note: -n (no clobber) for the mv command is non-standard extension to the POSIX standard. Alternatively, try using -i for interactive use (but some systems ignore -i when used in a non-interactive...
Forum: Shell Programming and Scripting 4 Weeks Ago
708
Posted By Scrutinizer
Hi, the reason that the script is so slow, is...
Hi, the reason that the script is so slow, is that it is firing off 12 different sub shells per line in the input file, so that is 12 million sub shells in total, which is quite costly.
Examples of...
640
Posted By Scrutinizer
Hi, try something like: count=$( cargo build...
Hi, try something like:
count=$( cargo build 2>&1 | grep -c 'error\[' )
Forum: Shell Programming and Scripting 4 Weeks Ago
809
Posted By Scrutinizer
Hi MadeInGermany, Can't you use: echo_e()...
Hi MadeInGermany,

Can't you use:
echo_e() {
printf "%b\n" "$*"
}

Instead?

The use of "$*" means that this only works as long as IFS is at the default:

$ IFS=,
$ echo -e "a\nb" c d...
Forum: Shell Programming and Scripting 4 Weeks Ago
1,319
Posted By Scrutinizer
It appears that it has been implemented in the...
It appears that it has been implemented in the system's regex engine, but that it does not work with globbing. On Linux, in bash 4 compare:
$ touch Miraré
$ for file in M*; do if [[ $file ==...
1,319
Posted By Scrutinizer
On Solaris 10, I tried the following, using the...
On Solaris 10, I tried the following, using the POSIX compliant utilities which are in /usr/xpg[46]/bin:

$ export PATH=/usr/xpg6/bin:/usr/xpg4/bin:$PATH
$ printf "%s\n" Estrés Miraré...
912
Posted By Scrutinizer
Hi, could you please post the input and output...
Hi, could you please post the input and output sample as code segments and not as attachments?

First off: if you want to match a circumflex, you need to escape with a backslash, since it is a...
816
Posted By Scrutinizer
Or try with -e: grep -Fe 'set char_1($lock)' -e...
Or try with -e:
grep -Fe 'set char_1($lock)' -e 'set new_char_clear_3($unlock)' filename.txt


---
With grep -E you need to escape both the dollarsigns and the parameters
grep -E 'set...
975
Posted By Scrutinizer
@ravinder, yes POSIX sort does not have a -s...
@ravinder, yes POSIX sort does not have a -s option, see:
sort (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html)

but GNU sort and BSD sort do.
975
Posted By Scrutinizer
@Ravinder nice different approach, in case the...
@Ravinder nice different approach, in case the sort utility understands stable sort.
975
Posted By Scrutinizer
Hi ksitij, I was in the process of adding an...
Hi ksitij, I was in the process of adding an explanation, it has been added to my post...
Showing results 1 to 25 of 500

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