Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: bedtime
4,868
Posted By bedtime
For those who care, I managed to come up with...
For those who care, I managed to come up with something more efficient. This code will also output even if there is no text:
a=${#text1};b=${#text2};echo $((a*b?(a>b?100*a/b:100*b/a):0))
4,868
Posted By bedtime
I prefer to only use functions when I'm going to...
I prefer to only use functions when I'm going to use them more than once in my code. In this case, it's only used once.


The strings are regular text. So long as the examples as we've used them...
4,868
Posted By bedtime
Thank you all for you solutions. I ended up going...
Thank you all for you solutions. I ended up going with vegersh99's solution as it was the most brief. I liked RudiC's mathmatics with the inverse equation.


Since I cannot have 'division by zero'...
4,868
Posted By bedtime
Thank you. This is cool in that it seems to solve...
Thank you. This is cool in that it seems to solve the 'division by zero' issue. :)


Yet this works in only one way.


For example:
$ text1='ab'; text2='abcd'; s1=${#text1}; s2=${#text2}
$...
4,868
Posted By bedtime
A better way to compare text length percentage?
I have a solution, but it seems labored. I would like to compare strings return a value in percent out of 100.


Such as:

$ text1='a'; text2='abc'; s1=${#text1}; s2=${#text2}
$ [ "$s1" -gt...
4,188
Posted By bedtime
I do, yes. I have all those directories. ...
I do, yes. I have all those directories.


At least I know where it's coming from now. Thanks.
4,188
Posted By bedtime
Echo displays strange output when '?' is used
In bash or sh terminal I get this strange response when using echo.


It's really best just to give you the code:

user@localhost:~$ text="?"; echo $text
P T V
user@localhost:~$ text='?'; echo...
5,284
Posted By bedtime
Thank you. I can confirm that this works. I can't...
Thank you. I can confirm that this works. I can't believe that I missed that variable too.:o
4,955
Posted By bedtime
Indeed. I've just added them. :o Such...
Indeed. I've just added them. :o



Such a simple solution. Thanks so much.
4,955
Posted By bedtime
Sed: would like to return an error for empty string
There are actually two things that I want to do:

1. Detect if there is a 3 digit number and if so return an error (working)
2. Detect if there is an empty string and return an error if so (not...
5,284
Posted By bedtime
Thank you. This solution didn't quite work for me...
Thank you. This solution didn't quite work for me as it didn't end up replacing the text:


((1)) ((2))


I did however use this method of defining the variable with sed and it worked fine.
5,284
Posted By bedtime
Perl: encoding changes and odd symbols
*** FIXED ISSUE - SOLUTION BELOW ***



This is a much simplified version of a script that I'm using. The program finds the number 1 in brackets-((1))-and replaces it with a sentence. The text is...
7,797
Posted By bedtime
I've attached the results. None of the subtitles...
I've attached the results. None of the subtitles seemed to translate properly. At least with me. I made sure to get rid of the '\r' on each .srt file with your code.


All the above files worked...
7,797
Posted By bedtime
If Google bans me when I'm using method #1...
If Google bans me when I'm using method #1 (below), I simply use method #2, and vice-versa.


Method #1 translation=$(wget -U "Mozilla/5.0" -q -O-...
7,797
Posted By bedtime
The files from your code are here:
The files from your code are here:
7,797
Posted By bedtime
This did help a lot. There still seems to be...
This did help a lot. There still seems to be several missing translations. I've attached the files for you.

Example:
Dialogue: 0,0:18:22.35,0:18:24.83,en,,0000,0000,0000,,one day he left his car...
7,797
Posted By bedtime
I'm going to give it a try tomorrow when I can...
I'm going to give it a try tomorrow when I can dedicate more time to it. Thank you so much! :)


Updated:


user@localhost:~$ seq -f'(%.f)' 5
(1)
(2)
(3)
(4)
(5)With:
echo...
7,797
Posted By bedtime
Google only bans for an hour or two. You'll be up...
Google only bans for an hour or two. You'll be up and running again quickly. ;)



Nice script! You are much better at this than I am. Much of the code is new to me, so it might take a while for...
7,797
Posted By bedtime
You are the first to run the script. Thank you!...
You are the first to run the script. Thank you! :o


Good point. And thank you so much for looking at my script.

Here is the issue with sending Google big chucks to translate: My first program...
7,797
Posted By bedtime
It's a great program, but I prefer my program to...
It's a great program, but I prefer my program to be independent. Most people don't want to have to install a script plus another program. Many are shy of scripts to begin with. My program does it all...
7,797
Posted By bedtime
Thank you for posting that code. I tried it, but...
Thank you for posting that code. I tried it, but it didn't have any effect. The code is more complex. The program takes the output of Google Translate and sifts through a bunch of garbage to find the...
10,038
Posted By bedtime
Thank you. I've done just that. Perl seems to be...
Thank you. I've done just that. Perl seems to be the perfect tool for this issue.


Sorry for the late reply.
7,797
Posted By bedtime
Combining two perl commands into one
I made a program that extracts quotes while retaining special inner quotes (in this case an 'x' followed by an apostrophe). The original program is far more complicated than this, but I wanted to...
10,038
Posted By bedtime
Automating find and replace REGEX expressions in a script
I've made several REGEX expressions which I would like to use to find and replace text in a .srt file:

For example, below, the first is the pattern to be found. The second is the replacement....
969
Posted By bedtime
Indeed it would! This is perfect! :) I'm guessing...
Indeed it would! This is perfect! :) I'm guessing that this is far more efficient than using awk.

I just added a 'head' command to chop off the rest of the lines after 5:
ps axeo comm...
Showing results 1 to 25 of 56

 

Featured Tech Videos

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