in ksh you can use typeset -L (or -R) to define space padded strings
when you are passing a value with embedded spaces you always need to double quote the variable, otherwise echo (or any other function/utility) would treat multiple consecutive spaces as a single argument separator.
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)
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT DEBIAN
libcaca-style
libcaca-style(3caca) libcaca libcaca-style(3caca)NAME
libcaca-style - Libcaca coding style
General guidelines
A pretty safe rule of thumb is: look at what has already been done and try to do the same.
o Tabulations should be avoided and replaced with eight spaces.
o Indentation is generally 4 spaces.
o Lines should wrap at most at 79 characters.
o Do not leave whitespace at the end of lines.
o Do not use multiple spaces for anything else than indentation.
o Code qui fait des warnings == code de porc == deux baffes dans ta gueule
C coding style
Try to use short names whenever possible (i for indices, w for width, cv for canvas...). Macros are always uppercase, variable and function
names are always lowercase. Use the underscore to separate words within names:
#define BROKEN 0
#define MAX(x, y) ((x > y) ? (x) : (y))
unsigned int x, y, w, h;
char *font_name;
void frobulate_every_three_seconds(void);
const is a suffix. It's char const *foo, not const char *foo.
Use spaces after commas and between operators. Do not use spaces after an opening parenthesis or before a closing one:
a += 2;
b = (a * (c + d));
x = min(x1, x2, x3);
Do not put a space between functions and the corresponding opening parenthesis:
int function(int);
A space can be inserted after keywords such as for, while or if, but consistency with the rest of the page is encouraged:
if(a == b)
return;
if (p == NULL)
Do not put parentheses around return values:
return a + (b & x) + d[10];
Opening braces should be on a line of their own, aligned with the current block. Braces are optional for one-liners:
int function(int a)
{
if(a & 0x84)
return a;
if(a < 0)
{
return -a;
}
else
{
a /= 2;
switch(a)
{
case 0:
case 1:
return -1;
break;
default:
return a;
}
}
}
C++ coding style
Nothing here yet.
Version 0.99.beta18 Fri Apr 6 2012 libcaca-style(3caca)