Powershell script to read column 2 data from .xlsx file [closed] - excel

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm trying to write a PowerShell script to get of 2 columns of a .xlsx file. Can anyone help me here.
My .xlsx file looks like this:
ProductName ProductCode
----------------------------------------------------------
Java 7 Update 75 {26374892-xxxx-xxxx-xxxx-123456789012}
Java 8 Update 25 {26374892-xxxx-xxxx-xxxx-902341562789}
I want output which will write only product codes line by line
{26374892-xxxx-xxxx-xxxx-123456789012}
{26374892-xxxx-xxxx-xxxx-902341562789}

You could use the ImportExcel Module by Doug Finke to import the spreadsheet into a PowerShell object to operate on:
Install-Module importexcel
Import-Excel C:\path\to\spreadsheet.xlsx | Select-Object -ExpandProperty ProductCode

Related

SoapUI change milliseconds value in delay step with groovy [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I would like to mass update existing delay steps in SoapUI with groovy that have the value 1000 milliseconds.
New value should be:
${=(int)(Math.random()*10000)}
Can anyone help?
The SoapUI project file is an XML file. You can replace values in that file with Groovy like this:
def projectFileA = new File('/path/to/your/soapui-project.xml')
def projectFileB = projectFileA.text.replaceAll('your old string', 'your new string')
projectfileA.text = projectfileB
If you don't have a Groovy IDE setup you can use groovyConsole, or you can try it in SoapUI itself.

Function outside look that requires a list to be generated that will randomly select 4 options [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
How to write this pseudo in python:
Display ‘ opening box’
Display ‘Item 1 of 4… common Item!’
‘Item 2 of 4…rare item!’
‘Item 2 of 4…epic item!’
‘Item 2 of 4…legendary item!’
The items are randomly choosen. When this function is called on in the body, it is meant to generate this list.
Try this below :
import random
items = ['Common Item', 'Rare Item', 'Epic Item', 'Legendary Item']
print("Opening Box\n")
for i in range(1, 5):
print('Item '+str(i)+' of 4 ----', random.choice(items))

LaTeX make only some listing use colour and not all (listings package) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
I added colour to the listings I create in latex using the following,
\usepackage{listings}% http://ctan.org/pkg/listings
\lstset{
basicstyle=\ttfamily,
mathescape
}
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\usepackage[colorinlistoftodos]{todonotes}
\lstset{frame=tb,
language=Python,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\small\ttfamily},
numbers=none,
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
breaklines=true,
breakatwhitespace=true,
tabsize=3
}
This applies the colouring to ALL listing that I create, I would like to create a new listing that does NOT use any colour, while keeping the colour for other listings.
Could someone tell me how to do that, or if it is even possible ?
Thank you
All the commannds that are given to a \lstset can be given as an optional parameter to a specific listing.
So you can do
\begin{lstlisting}[keywordstyle=\color{black},
commentstyle=\color{black},
stringstyle=\color{black},
]
< your program >
All the other parameters remain unchanged, but you can change specific values as required.
Another way, is to define styles.
\lstdefinestyle{nocoloring}{
keywordstyle=\color{black},
commentstyle=\color{black},
stringstyle=\color{black}
}
\begin{lstlisting}{style=nocoloring}
< your program >

Shell scipt to convert bit string to text value code [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have 32 bit string of 0s. Each bit in the string represents some code, for e.g.
1000000000000000000000000000000 = ABC
0100000000000000000000000000000 = DEF
...
0000000000000000000000000000001 = XYZ
I have file of string bit, is there any way to shell script the output to code
for. e.g
1100000000000000000000000000000 should print ABC|DEF
Thanks for your inputs.
edit1:
#nullPointer : the 3 digit letters are example of human readable representation of the 32 bit representation.
In bash:
codes=("ABC" "DEF" ... "XYZ")
bitstring=1100000000000000000000000000000
outstring=""
for i in {0..31}; do
if [ "${bitstring:i:1}" = 1 ]; then
outstring+="|${codes[i]}"
fi
done
echo "${outstring#|}"

Need to replace line from one file based on another file in Linux bash shell [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have two files , one as a template and other as a input file for next command. I have to update my input file based on the values in template
First file looks like as shown below
TKTSPEC.2.ASSETATTRID=REVISION&
TKTSPEC.2.REFOBJECTID=31&
TKTSPEC.2.TICKETSPECID=410&
TKTSPEC.2.SECTION=&
TKTSPEC.3.ASSETATTRID=NUM&
TKTSPEC.3.REFOBJECTID=31&
TKTSPEC.3.TICKETSPECID=411&
TKTSPEC.3.SECTION=&
TKTSPEC.4.ASSETATTRID=MPNUM&
TKTSPEC.4.REFOBJECTID=31&
TKTSPEC.4.TICKETSPECID=412&
TKTSPEC.4.SECTION=&
My Template file looks like
TKTSPEC.2.ASSETATTRID=REVISION&
TKTSPEC.2.TABLEVALUE=5&
TKTSPEC.3.ASSETATTRID=NUM&
TKTSPEC.3.TABLEVALUE=RDPVS&
TKTSPEC.4.ASSETATTRID=MPNUM&
TKTSPEC.4.TABLEVALUE=NEWPROJECT&
My Desired output is as follows
TKTSPEC.2.ASSETATTRID=REVISION&
TKTSPEC.2.TABLEVALUE=5&
TKTSPEC.2.REFOBJECTID=31&
TKTSPEC.2.TICKETSPECID=410&
TKTSPEC.2.SECTION=&
TKTSPEC.3.ASSETATTRID=NUM&
TKTSPEC.3.TABLEVALUE=RDPVS&
TKTSPEC.3.REFOBJECTID=31&
TKTSPEC.3.TICKETSPECID=411&
TKTSPEC.3.SECTION=&
TKTSPEC.4.ASSETATTRID=MPNUM&
TKTSPEC.4.TABLEVALUE=NEWPROJECT&
TKTSPEC.4.REFOBJECTID=31&
TKTSPEC.4.TICKETSPECID=412&
TKTSPEC.4.SECTION=&
I have to check the ASSETATTRID from my first file and then insert a new line with corresponding value from the second file.Second file has value for every assetattrid.
Can this be acheived using awk or other linux based commands ?
One way:
awk -F. 'NR==FNR{getline x;a[$2$3]=x;next}$2$3 in a{print;print a[$2$3];next}1' templatefile inpfile
this oneliner may work for you:
awk 'NR==FNR{k=$0;getline;a[k]=$0;next}$0 in a{$0=$0"\n"a[$0]}1' templ input

Resources