Search Results

Search: Posts Made By: balajesuri
Forum: Programming 11-04-2019
455
Posted By balajesuri
Since you're using python3, you can also take...
Since you're using python3, you can also take advantage of string formatting:


'https://www.meihoski.co.jp/movie/{}'.format(a['href'])

Check this out: 6.1. string — Common string operations —...
Forum: Programming 09-05-2019
3,778
Posted By balajesuri
Minor edit
1. Read the file "SHA256" line by line in a loop. (for line in filehandle)

2. Tokenise each line as you read - the result will be stored in a list (hint: split after you strip)

3. The last item...
296
Posted By balajesuri
I think OP is asking for side by side printing of...
I think OP is asking for side by side printing of the output of two python scripts as they run, and has shown as an example, concatenation of two text files using izip_longest().


@bigvito19...
1,221
Posted By balajesuri
grep -P -B 10 -A 9 'Status: ...
grep -P -B 10 -A 9 'Status: (?!Clear)' alarm.txt
Forum: Programming 07-25-2019
827
Posted By balajesuri
A more pythonic way ;) N =...
A more pythonic way ;)



N = int(input("Please enter number:"))
t = sum([int(input("Enter Numbers %d:" %i)) for i in range(1, N+1)])
print(t)
201
Posted By balajesuri
I think your set -x gives pretty clear idea that...
I think your set -x gives pretty clear idea that "srvctl config database...." is not having any output. So $STANDBY_CONF is empty.
May be you want to check by running this command directly on...
2,534
Posted By balajesuri
Best place to start is the AWK manual: The GNU...
Best place to start is the AWK manual: The GNU Awk User’s Guide (https://www.gnu.org/software/gawk/manual/gawk.html)
Then you need lot of patience, practice, reading forums like this one and think...
240
Posted By balajesuri
Few simple modifications: #!/bin/bash ...
Few simple modifications:



#!/bin/bash

VarSize=${1-5} # use $1 if defined, else set VarSize as 5
OptSize=${2-3} # use $2 if defined, else set OptSize as 3
HomeSize=${3-2} # use $3 if...
Forum: Programming 03-09-2018
1,068
Posted By balajesuri
In a class, if you declare a method as static,...
In a class, if you declare a method as static, you need not instantiate the class to be able to use the method. So , in your program, the method change() is being called directly by qualifying it...
622
Posted By balajesuri
I'm not sure if this is a rule. But I generally...
I'm not sure if this is a rule. But I generally write the functions before i call them. Can you try putting panel() before execute() and run your code.
768
Posted By balajesuri
If you know the first and last ID, why not...
If you know the first and last ID, why not generate the sequence yourself:
[user@host ~]$ seq -f "RETT-%.0f" 1 5
RETT-1
RETT-2
RETT-3
RETT-4
RETT-5
361
Posted By balajesuri
Please let us know which OS you're using. It is...
Please let us know which OS you're using. It is important for this question because on most *nix flavours, the creation time is not stored in filesystem.

On windows, you can use...
725
Posted By balajesuri
awk -F "," '$8 < 0{$8=$8*-1} {sum+=$8} END...
awk -F "," '$8 < 0{$8=$8*-1} {sum+=$8} END {printf "%.2f\n", sum}' file
1,983
Posted By balajesuri
1. To loop over the files matching a particular...
1. To loop over the files matching a particular pattern in a given directory, you can use the for (http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html) loop construct. For e.g.,
for file in *.log
do...
1,242
Posted By balajesuri
Merely posting that there are errors is not...
Merely posting that there are errors is not helping much.

What errors do you get on running this script?
What did you understand from the errors?
4,060
Posted By balajesuri
x="ABCD" n=10 n=$((n + ${#x})) printf...
x="ABCD"
n=10
n=$((n + ${#x}))
printf "%${n}s" $x
1,748
Posted By balajesuri
Use for-loop. But I suppose you would want to...
Use for-loop. But I suppose you would want to change the email body and subject per attachment. I leave it to you to figure it out.

for ATTACHMENT_FILE in /path/to/folder/* # assuming folder has...
Forum: What is on Your Mind? 07-22-2016
1,332
Posted By balajesuri
Thanks for sharing knowledge with all of us....
Thanks for sharing knowledge with all of us. Indeed, it's a great selfless service. You rock! :):b:
766
Posted By balajesuri
[user@host ~]$ cat test.sh #! /usr/bin/bash ...
[user@host ~]$ cat test.sh
#! /usr/bin/bash

file=$1
logfile="file"

in_dt=$(grep "PUT.*$file" $logfile | cut -d' ' -f1,2)
out_dt=$(grep "DELETE.*$file" $logfile | cut -d' ' -f1,2)
...
2,820
Posted By balajesuri
sed -i basically uses a tmp file and then...
sed -i basically uses a tmp file and then renames it to the original file. You could do the same. So, send the output to a new temp file. Rename the tmp file to original file.

sed '1s/^..//' file...
2,820
Posted By balajesuri
use sed -i [user@host ~]$ cat file hello ...
use sed -i

[user@host ~]$ cat file
hello
world
[user@host ~]$ sed '1s/..//' file
llo
world
[user@host ~]$ sed -i '1s/..//' file
[user@host ~]$ cat file
llo
world
[user@host ~]$
588
Posted By balajesuri
l=$(wc -l file | cut -d' ' -f1); sed "3,$(( l-1...
l=$(wc -l file | cut -d' ' -f1); sed "3,$(( l-1 ))s/.*UsageData.*//" file
923
Posted By balajesuri
ignoreTables=( visitors_15012016...
ignoreTables=( visitors_15012016 visitors_Original )

ignoreString=''
for tbl in ${ignoreTables[@]}
do
ignoreString=${ignoreString}"--ignore-table="${tbl}" "
done

mysqldump...
1,652
Posted By balajesuri
awk '{x=$0; getline; x=x"\n"$0; a[x]++}END{for (i...
awk '{x=$0; getline; x=x"\n"$0; a[x]++}END{for (i in a){print i, a[i], "rows"}}' file
1,179
Posted By balajesuri
To me, sed seems a simpler alternative: ...
To me, sed seems a simpler alternative:
user@host~> sed 's/,/ /g' file
xyz pqrs.lmno NA NA NA NA NA NA NA
abcd pqrs.xyz NA NA NA NA NA NA NA
user@host~>Correction to your command:
awk -F","...
Showing results 1 to 25 of 500

 

Featured Tech Videos

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