10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
My string variable which gets the output from the result of a database query has values as below:
line="2019-09-11 15:17:55 CR1234 anonymous Deployed DR_only Back_APP"
I wish to construct an array (my_array) which should have entries as below.
Note:
1. The first... (6 Replies)
Discussion started by: mohtashims
6 Replies
2. Shell Programming and Scripting
I would like to find an undetermined number of spaces and shorten them to one space. I am running Debian in mksh. Script running in #!/bin/sh. Sorry to not include all code. The program is too big and involves an online file... too much hassle to solve a simple issue.
Ex.,
I start with... (11 Replies)
Discussion started by: bedtime
11 Replies
3. Shell Programming and Scripting
when given a file name, im looking for the most efficient way to turn each letter of the file name into spaces.
for instance, the way im thinking of going about this is this:
MYFILE=check_disks.sh
CHANUM=$(echo ${MYFILE} | awk '{ print length }')
printf '%s\n' $CHANUM
as you can see... (4 Replies)
Discussion started by: SkySmart
4 Replies
4. Shell Programming and Scripting
i'm looking for a command that allows me to print a specific number of spaces which i will provide.
something as simple as:
spaces=4
printf " " * $spaces
i'm looking for somethign that'll allow me to print a specific amount of spaces on a line.
can awk be used for this? (4 Replies)
Discussion started by: SkySmart
4 Replies
5. Shell Programming and Scripting
Here is a weird question :)
i am trying to create a script written in bash that will create configuration files for nagios. As some of you aware is has to be written in the below format:
define service{
option1 value1
option2 value2... (6 Replies)
Discussion started by: ppolianidis
6 Replies
6. UNIX for Dummies Questions & Answers
which one of the following is the correct expression to ignore line with multiple spaces after any string
cat file | grep -v "xyz *$"
or
cat file | grep -v "xyz*$"
do i need "*" to specify the sapce or " *" will do? (2 Replies)
Discussion started by: manishma71
2 Replies
7. Shell Programming and Scripting
Hi,
i call my shell like:
my_shell "my project name"
my script:
#!/bin/bash -vx
projectname=$1
sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp
cp temp test_config_doxy
the following error occurres:
sed s/'PROJECT_NAME ... (2 Replies)
Discussion started by: vivelafete
2 Replies
8. Shell Programming and Scripting
How do i split a variable of numbers with spaces... for example
echo "100 100 100 100" > temp.txt
as the values can always change in temp.txt, i think it will be feasible to split the numbers in accordance to column.
How is it possible to make it into $a $b $c $d? (3 Replies)
Discussion started by: dplate07
3 Replies
9. Shell Programming and Scripting
Hi
I have an XML file with strings XABCD, XEFGHX and XIJKLX. I would like to replace XABCDX with "This is the first string", XEFGHX with "This is the second string" and XIJKLX with "This is the third string".
What is the best way to implement this? Should I have a file with the data that is... (4 Replies)
Discussion started by: zmfcat1
4 Replies
10. UNIX for Dummies Questions & Answers
HI
In my script, i am reading the input from the user and want to find the length of the string.
The input may contain leading spaces. Right now, when leading spaces are there, they are not counted.
Kindly help me
My script is like below. I am using the ksh.
#!/usr/bin/ksh
echo... (2 Replies)
Discussion started by: dayamatrix
2 Replies