How to insert a : in between numbers in Robot Framework - format

I have a number 1234. I want an out put as 12:34. Tried this
$$time} Set Variable As 1234
${formattedTime} Evaluate "{::.0f}".format(${time})
Didn't work. Please help. Thanks
Tried this
$$time} Set Variable As 1234
${formattedTime} Evaluate "{::.0f}".format(${time})
`..

Related

what is the meaning of : ${CONTAINER_CLI:="docker"} in shell scripting

I am learning shell scripting and came across this line
: ${CONTAINER_CLI:="docker"}
can someone please explain me what this line do? what is the meaning of : here?
man bash command said:
${parameter:=word}
Assign Default Values.
If parameter is unset or null, the expansion of word is
assigned to parameter.
The value of parameter is then substituted.
Positional parameters and special parameters
may not be assigned to in this way.
So, the variable CONTAINER_CLI is assigned with the value docker if CONTAINER_CLI does not exists or empty.
But... if you simply write :
${CONTAINER_CLI:="docker"}
You obtain an error if the result is not a command.
You just want make a assignation.
Put simply a : before.
It's like:
CONTAINER_CLI=${CONTAINER_CLI:="docker"}

Invalid Number with Substitution Variable

I am having trouble trying to get an input to be accepted as a number variable. Here is the code I have:
ACCEPT clientidnum NUMBER PROMPT 'Enter Client Number(s): '
SELECT * FROM PROD.GS_EXTERNAL_CONTACT#prd1.WORLD
WHERE GEC_GS_EXT_CONTACT_ID IN (SELECT GEC_GS_EXT_CONTACT_ID
FROM PROD.CLIENT#prd1.WORLD a
WHERE CT_CLIENT_ID = to_number(trim(replace('&clientidnum',CHR(13)))) AND
a.GEC_GS_EXT_CONTACT_ID NOT IN (SELECT GEC_GS_EXT_CONTACT_ID
FROM PROD.GS_EXTERNAL_CONTACT b
WHERE a.GEC_GS_EXT_CONTACT_ID= b.GEC_GS_EXT_CONTACT_ID));
And when I run this in SQL Plus, it comes back with the below error:
ERROR at line 4:
ORA-01722: invalid number
Thanks for the assistance! Sorry if this is an easy question, but I'm use to SQL Server and was thrown on Oracle to get some things to work correctly.
Figured it out. SET DEFINE was set to OFF in my glogin.sql script. I added SET DEFINE ON to the script I am running and it works.

Variable position in echo is changing the result

I used grep to fetch result from two files and store the result in two variable respectively.
while I echo the output of two variable at that time if I change the position of variable then the result is changing .
The scenario is explained below with the example
i=123
res1=`grep S$i $NamesFile`
res2=`grep S$i $FeeInformation|awk '{$1="" ; print $0}'`
echo "$res1 $res2" ## this prints the value from both variable separated by space
echo "$res2 $res1" ## in this the variable two override the output of variable one
the issue is happening only on my terminal I tested it in other machine it is working fine , even In my terminal it was working till yesterday , don't know what change has happened which impacted this
NameFile contains the information like Student_id Name_of_student Mobile_No Location Email_id
FeeInformation file contains values Student_id Class Fee Admission_type(DOnation/Free)
Please suggest what could be the possible reason for this .
Thanks in advance
the linefeed character \r was causing the issue

Parameterizing table name in sqlplus input file

I am trying to export some data using sqlplus and the Oracle spool functionality. The problem is that the SQL input file where I am defining my export is not letting me parameterize the table name from which I am exporting data -- it wants a literal :(
Calling sqlplus in a shell script:
sqlplus $USER/$PASSWD#$ORADB<<!
#export.sql $OUT_FILE $SOME_VAR $ENV
exit
!
export.sql:
set heading off
set head off
set term off
set tab off
set embedded on
set feedback off
set pagesize 0
set linesize 800
set trimspool on
set verify off
spool &1
SELECT '&2|' || some_col
FROM &3_TABLE
/
spool off
When $ENV is set to 'dev', I get
Enter value for 3_TABLE
whereas I want it to use dev_TABLE. When I unparameterize the table names in the sql file, the output runs fine. Also note that there is param &2, which is $SOME_VAR from the shell and it gets displayed evaluated fine. The only problem is in the FROM statement.
Is there any way to tell the sql input file to replace the parameterized table names before running SQL?
Thanks
The problem is that SQL*Plus is treating the whole string after the &, up to the next whitespace or simlar, as the substitution variable name. Clearly that isn't what you want here.
Fortunately they've thought of this, and you can denote the end of the variable name with a .:
FROM &3._TABLE
(At least, that works for named variables, and I'm almost sure it will for positional ones... if not then you'd need to define a new variable set to &3 as a workaround).
It is in the documentation, but blink and you'll miss it:
If you wish to append characters immediately after a substitution
variable, use a period to separate the variable from the character.
There's a related effect that you may want to bear in mind for the future. If the next character after the substitution variable is a . anyway - between the schema and table, or between table and column, for example - then that will be interpreted as the substitution terminator. Say you were passing the schema separately as &4, with value 'scott'; this:
FROM &4.&3._TABLE
looks reasonable but would be substituted as scottdev_TABLE, which won't be recognised. So in that instance you need to have an extra one:
FROM &4..&3._TABLE
which would be substituted as scott.dev_TABLE.

Export data from mathematica script

I am writing a mathematica script and running it in the linux batch shell. The script gives as a result a list of numbers. I would like to write this list to a file as a one single column without the braces and commas. For this, I tried to use Export comand as
Export["file.txt", A1, "Table"]
but I get the error:
Export::infer: Cannot infer format of file test1.txt
I tried with other format but i got the same error.
Could someone please tell what is wrong and what i can do? Thank beforehand
From what I understand you are trying to export the file in TABLE, why don't you try something like this ,
Export["file.txt", A1, "Text"]
This:
A1 = {1,2,3};
Export["test.tab", Transpose[{A1}], "Table"];
produces a single column without braces and commas.

Resources