Parsing a csv file to add details to xml file

Ned help to parse a csv file which has following details to xml file csv file is in the following format: name,ip,timeout domain\user1,10.119.77.218,9000 domain\user2,2.80.189.26,9001 domain\user3,4.155.10.110,9002 domain\user4,9.214.119.86,9003 domain\user5,4.178.187.27,9004 domain\user6,3.76.178.117,9005 The above details from csv needs to be added to XML file which has the following format: <login> <entry name="domain\user1" ip="10.119.77.218" timeout="9000"/> <entry name="domain\user2" ip="2.80.189.26" timeout="9001"/> <entry… Read More Parsing a csv file to add details to xml file

google sheets active cell highlight and un highlight concern that you have with clearing the format of the cell within the code

where active cell will highlight matchings cell on rest of sheet once its move to anther cell then old highlight will be back to Normal and new cell match will highlight, as well let me know in scripts that where I Can change Column change if i want to move from A and B to… Read More google sheets active cell highlight and un highlight concern that you have with clearing the format of the cell within the code

How to check if a user exists and create the user if the name is free?

I’m trying to create a user creator script, and I keep getting stuck. I just started learning bash shell scripting, so I’m not very good. Here’s my script: #!/bin/bash clear echo "Welcome to" echo "USER CREATOR" echo "How many user accounts would you like to create?" read num echo "What would you like the username… Read More How to check if a user exists and create the user if the name is free?

How to get a list of merge commits to develop that are not merged to master … and vice versa

Our workflow is very manual at the moment. Jira for tickets, Bitbucket for repos. Many repos. Way too many repos. Using Sourcetree, showing the develop branch, parents only, compare against a spreadsheet we have maintained for years of all the different repos and so we can see (and make reports/charts) of what and when merges… Read More How to get a list of merge commits to develop that are not merged to master … and vice versa

how to count duplicates in a list of tuples and append it as a new value

output = [(‘studentA’,’ISDF’), (‘studentB’,’CSE’),(‘studentC’,’BIO’),(‘studentA’,’ISDF’), (‘studentB’,’CSE’),(‘studentC’,’BIO’),(‘studentA’,’ISDF’), (‘studentB’,’CSE’),(‘studentC’,’BIO’),(‘studentA’,’ISDF’), (‘studentB’,’CSE’),(‘studentC’,’BIO’),(‘studentA’,’ISDF’), (‘studentB’,’CSE’),(‘studentC’,’BIO’),(‘studentA’,’ISDF’), (‘studentB’,’CSE’),(‘studentC’,’BIO’)] so here there are total of 6 set of (‘studentA’,’ISDF’), (‘studentB’,’CSE’),(‘studentC’,’BIO’) in this above list so Im expecting an output like this ~ expected_output = [(‘studentA’,’ISDF’,6), (‘studentB’,’CSE’,6),(‘studentC’,’BIO’,6)] The format should be [(‘student’, ‘department’, total count)] >Solution : Try this: sorted([tuple(list(item)+[output.count(item)]) for item in set(output)])

Bad substitution in Bash

I have written this code in which m getting bad substitution error. Please help here. #!/bin/bash function detect_value(){ #some operation gives u a value echo "ABCD" } ABCD_COUNT=26 echo "${"$(detect_value)"_COUNT}" bash run.sh run.sh: line 12: ${"$(detect_value)"_COUNT}: bad substitution >Solution : The name of a parameter has to be static, not produced by another expression. To… Read More Bad substitution in Bash

bash script to alter array elements and write to new array

I would like a bash script to take the elements from array1 and output them differently in array2. array1 – array1=(s3://root/sub1/sub2/ 2022-10-22 2021-09-13 2020-08-15 s3://root/sub1/sub2/ 2022-09-22 2021-08-07 2020-02-03  s3://root/sub1/sub2/ 2022-08-22 2021-07-17 s3://root/sub1/sub2/ 2022-07-22) array2- array2=(s3://root/sub1/sub2/2022-10-22/ s3://root/sub1/sub2/2021-09-13/ s3://root/sub1/sub2/2020-08-15/ s3://root/sub1/sub2/2022-09-22/ s3://root/sub1/sub2/2021-08-07/ s3://root/sub1/sub2/2020-02-03/ s3://root/sub1/sub2/2022-08-22/ s3://root/sub1/sub2/2021-07-17/ s3://root/sub1/sub2/2022-07-22/) So I basically want to take the url from array1 and append each date… Read More bash script to alter array elements and write to new array

Convert .csv to Excel file using bash shell script

I’m trying to convert a .csv file to Excel using unix shell script. Tried the below script but it didn’t work. ./csv2xls -csv-file-name="file1.csv" -xls-file-name="file1.xls" -csv-delimiter="|" I tried using the below script to convert csv to unix format dos2unix file1.csv Not sure how to convert it to Excel format. Can anyone guide how to convert this… Read More Convert .csv to Excel file using bash shell script