# Search Results

 04-23-2020 4,833 Posted By sea Thats why I prefer functions: bigger_value() {... Thats why I prefer functions: bigger_value() { # str1 str2 [[ ! 2 -eq \$# ]] && echo "Usage: \$FUNCNAME str1 str2" >&2 && return 1 echo \${#1} \${#2} | awk '{a=b=\$1;(\$1>\$2)?a=\$2:b=\$2;if(a*b){print...
 04-24-2020 4,833 Posted By vgersh99 How about: echo \${#text1} \${#text2} | awk... How about: echo \${#text1} \${#text2} | awk '\$1*\$2{a=b=\$1;(\$1>\$2)?a=\$2:b=\$2;print int(100/a*b)}'
 04-23-2020 4,833 Posted By vgersh99 a bit simpler - the order doesn't matter: ... a bit simpler - the order doesn't matter: echo \${#text1} \${#text2} | awk '{a=b=\$1;(\$1>\$2)?a=\$2:b=\$2;print (100/a*b) }'
 04-23-2020 4,833 Posted By RudiC Try also awk -v"T1=\$text1" -v"T2=\$text2" 'BEGIN... Try also awk -v"T1=\$text1" -v"T2=\$text2" 'BEGIN {PC = length(T1) / length (T2); print 100 * (PC<1?1/PC:PC) "%"}' 300%
 04-23-2020 4,833 Posted By sea Why? In your 2nd example, the 2nd value is 50%... Why? In your 2nd example, the 2nd value is 50% of the first value. (\${#text1} > \${#text2}) That is 100% accurate. If you want to get only the bigger value, you need to switch the echo'd values,...
 04-21-2020 4,159 Posted By RudiC I bet you have a P , a T , and a V file in... I bet you have a P , a T , and a V file in your working directory, as ? is a "special pattern character" that "matches any single character" (cf man bash).
 04-13-2020 5,268 Posted By Chubler_XL Apologies, I forgot to set \$num in my example: ... Apologies, I forgot to set \$num in my example: \$ text='QIl reçoit 5 000 \$ à la livraison. 5 000 \$?' \$ num=1 \$ echo '((1)) ((2))' > temp.tmp \$ perl -i -CA -pne 'my \$val='\'"\${text}"\'';...
 04-13-2020 4,941 Posted By RudiC Try testing for "start-of-line nothing... Try testing for "start-of-line nothing end-of-line": echo "" | sed -n -r '/[0-9]{3}/{q100}; /^\$/{q200}'; echo \$? 200And, wouldn't it make sense to have different codes for different errors?
 04-12-2020 5,268 Posted By Chubler_XL I found the problem with the perl code \$ is... I found the problem with the perl code \$ is expanded in perl RE to avoid this I put the string in a perl variable with single quotes around it like this: \$ text='QIl reçoit 5 000 \$ à la livraison....
 04-11-2020 3,170 Posted By MadeInGermany arr=("\$@") Quotes around \$@ (and \${arr[@]})... arr=("\$@") Quotes around \$@ (and \${arr[@]}) protect against word splitting and other substitutions, but still retain the list of argument members (and other array members). In contrast, with \$*...
 04-11-2020 3,170 Posted By RudiC It doesn't work that way. First, you need to use... It doesn't work that way. First, you need to use a "command substitution" for the seq command. Then, \$X will be expanded to 1 .. \$#, NOT to the values of the respective positional parameters. There...
 04-09-2020 7,769 Posted By nezabudka Hi @bedtime thank you. Indeed, translating... Hi @bedtime thank you. Indeed, translating into French is much more complicated. I tagged a release in v2.0.0 with support for multi-line subtitles. Maybe this will change the situation? In...
 04-07-2020 7,769 Posted By nezabudka Hi file Mother.srt Mother.srt: UTF-8 Unicode... Hi file Mother.srt Mother.srt: UTF-8 Unicode text, with CRLF line terminators sed -i 's/\r//g' Mother.srt file Mother.srt Mother.srt: UTF-8 Unicode text ./to.sh Mother.srt parameters...
 04-05-2020 7,769 Posted By nezabudka Hi I added a description to the repository.... Hi I added a description to the repository. your 'seq' swears either at the wrong format or at the absence of a parameter. Try in the terminal first: seq -f'(%.f)' 5 If everything works well then...
 04-03-2020 7,769 Posted By nezabudka Hello A good idea. I also started up. nezabudka... Hello A good idea. I also started up. nezabudka / srt_to_ass . GitLab (https://gitlab.com/nezabudka/srt_to_ass) I tried to work with your script, but since I have slow Internet, I was not able to...
 03-28-2020 7,769 Posted By nezabudka In the Fedora is install like this dnf install... In the Fedora is install like this dnf install translate-shell And thank you I liked the program, I'll try to work with it. I'm just learning English :)
 03-28-2020 7,769 Posted By nezabudka Or maybe just do throw an agent? GitHub -... Or maybe just do throw an agent? GitHub - soimort/translate-shell: Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc....
 03-18-2020 10,000 Posted By balajesuri You may try perl. When it comes to regex and... You may try perl. When it comes to regex and string parsing, perl handles them beautifully. Of course, doesn't mean you don't have other options.
 07-23-2018 968 Posted By vgersh99 wouldn't this suffice (or a variation of): ps... wouldn't this suffice (or a variation of): ps -axeo comm --no-header --sort=-%cpu
 03-01-2018 4,972 Posted By RudiC This is my personal feeling: It is well known... This is my personal feeling: It is well known that any dedicated compiled program, be it C, C++, Pascal, or other, usually benefit from increased execution speed compared to e.g. scripts. But there...
 Forum: Programming 03-07-2018 1,393 Posted By jim mcnamara Oh. I assumed too much. If you are going to... Oh. I assumed too much. If you are going to code in Unix, please consider reading/referring to one of these books - the calls I mentioned are all explained with examples: Michael Kerrisk 'The...
 Forum: Programming 03-06-2018 1,393 Posted By jim mcnamara Overview: I'm not going to figure out all of... Overview: I'm not going to figure out all of the above wall of code. This example is how MS windows and X work. A simple, fairly stupid, event (message) pump that does nothing but read stdin, then...
 Forum: Programming 03-01-2018 1,014 Posted By RudiC Good you had another improvement of your code.... Good you had another improvement of your code. Applying what you learned in some of your other threads (gsub (tagIn "[^" tagOut "]*" tagOut, ""), post7 (https://www.unix.com/303013697-post7.html),...
 Forum: Programming 03-01-2018 1,014 Posted By Don Cragun We assume that you know that exactly the same... We assume that you know that exactly the same thing works in awk: echo "This html code contains . All tags must go, but some must be replaced with
 Forum: Programming 02-28-2018 1,014 Posted By Don Cragun When trying to match the end of a tag with its... When trying to match the end of a tag with its start, you need to look for the entire tag in a single search. Since there are several tags on the line, the way you are searching for the end tag may...
 Showing results 1 to 25 of 42

## Featured Tech Videos

All times are GMT -4. The time now is 01:45 PM.