10-04-2016
Quote:
Originally Posted by
Don Cragun
I must be missing the point. You show us a very inefficient script that uses two shells and an awk to print the number of characters in the value of a shell variable. I do not understand how this relates to turning each individual letter (which presumably does not include underscores and periods [and digits, but there aren't any digits in the given sample input]) into an unspecified number of <space> characters.
Please give us a clear specification of what you are trying to do, and tell us what operating system and shell you're using.
how do i print a specific number of spaces, which is equal to the number of characters in a name.
say a user specifies the name: check_disks.sh
there are 14 characters in the name "check_disks.sh".
i want to now print 14 spaces.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
using sed to replace a specific string on a specific line number using variables
this is where i am at
grep -v WARNING output | grep -v spawn | grep -v Passphrase | grep -v Authentication | grep -v '/sbin/tfadmin netguard -C'| grep -v 'NETWORK>' >> output.clean
grep -n Destination... (2 Replies)
Discussion started by: todd.cutting
2 Replies
2. Shell Programming and Scripting
Hi All,
If anybody could help me with my scenario here. I have a statement file. Example of some content:
DATE DESC Debit Credit Total Rate
02-Jan-08 Lodgement 200.00 1200.00 2.51
14-Sep-07 Withdrawal 50.00 1000.00 ... (8 Replies)
Discussion started by: yonez
8 Replies
3. 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
4. Shell Programming and Scripting
Hi,
I have a requirement to remove certain spaces from a table of information, but I'm unsure where to start.
A typical table will be like this:
ABCDE 1 Elton John 25 12 15 9 3
ABCDE 2 Oasis 29 13 4 6 9
ABCDE 3 The Rolling Stones 55 19 3 8 6The goal is to remove only the spaces between... (11 Replies)
Discussion started by: danhodges99
11 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. Shell Programming and Scripting
Hello All,
I have a comma separated file which needs to be loaded to the database. But, I need to trim the white spaces for a specific column before its loaded.
Below is the sample line from the input file:
690,690,0575,"01011940","01011940", , , , , ,36720,36722,V2020,V2999,... (6 Replies)
Discussion started by: Praveenkulkarni
6 Replies
7. Shell Programming and Scripting
Hi,
How to print the number of fields in each record with the line number?
Lets saw I have
3212|shipped|received|
3213|shipped|undelivered|
3214|shipped|received|delivered
I tried the code
awk -F '|' '{print NF}'
This gives me ouput as
3
3
4 (5 Replies)
Discussion started by: machomaddy
5 Replies
8. Shell Programming and Scripting
Hi consider the source file
R|field1|field2
using the print statement in awk prints it as
R field1 field2
Is there an easier way to print the whole line in its original format (i.e. with | delimiters) than doing print $1"|"$2"|"$3 ??
Thanks
Storms (1 Reply)
Discussion started by: Storms
1 Replies
9. UNIX for Dummies Questions & Answers
Hi
I have a file which is tab-delimited. Now, I'd like to print the lines which have "chr6" string in both first and second columns. Could anybody help? (3 Replies)
Discussion started by: a_bahreini
3 Replies
10. 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