03-03-2011
Add trailing zero in a number
how to add a trailing zero in a number?
For example:
Input- 00000734560
output- 000007345600
Thanks in advance.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi there,
I need to add a sequence of numbers to existing variables within the script to be able to call the variable automatically. Somehow it's just printing the loop number. Here's what I've got so far. :eek:
#!/bin/sh
FOLDER1=foo
FOLDER2=bar
FOLDER3=beer
for ((a=1; a <= 3 ; a++))... (2 Replies)
Discussion started by: siul0_0
2 Replies
2. Shell Programming and Scripting
Hi Folks,
Using the Vi, how can I add a numbers at the end of the line.
For eg: I have the numbers in the file as:
58.125.33
22.58.68
25.144.225
114.25.38
I need to add .0/8 at the end of all the line. So, it should be like
58.125.33.0/8
22.58.68.0/8
25.144.225.0/8
114.25.38.0/8 (6 Replies)
Discussion started by: gsiva
6 Replies
3. Shell Programming and Scripting
I have textfile (source.txt) with different length of lines in it. Can anybody help to compose a script under bash which would add suitable number of trailing spaces to the end of each line so that after the processing the each line would have the same (let's say 100 char) length? Output can be... (6 Replies)
Discussion started by: sameucho
6 Replies
4. Shell Programming and Scripting
echo "scale=2; 282.73/640" | bc
This will print .44
How to make the variable as 0.44 (2 Replies)
Discussion started by: sandy1028
2 Replies
5. Shell Programming and Scripting
Hi experts a have a very large file and I need to add two columns: the first one numbering the incidence of records and the another with the total count
The input file:
21 2341 A
21 2341 A
21 2341 A
21 2341 C
21 2341 C
21 2341 C
21 2341 C
21 4567 A
21 4567 A
21 4567 C
... (6 Replies)
Discussion started by: juelillo
6 Replies
6. Shell Programming and Scripting
Hi,
I have a file po8282.fmt998.fbi.mopac.x.macs.btt.txt . I want to parse the first field which is separated by "." and then find the number and add 1 to it.
here is what I am doing to get the first field, but not sure how to only pick the number and add 1 to it... (5 Replies)
Discussion started by: rudoraj
5 Replies
7. UNIX for Dummies Questions & Answers
I want to keep string/varible length to 10 even its actual length is less than 10(may be no value). so, i want to add trailing spaces to my string. :wall:
"typeset -L10 myvarible" is not working, its saying invalid typset -L option.
Can you please advise. (4 Replies)
Discussion started by: djaks111
4 Replies
8. Shell Programming and Scripting
I have some strings such as
ABC1
ABC2
TYFASDD12
They will only have letters and numbers. In each case I want to remove the last digit? The lengths will vary. So a hard coded substr won't work. What do I do?
if it doesn't end in a number, I don't want to remove any characters. (6 Replies)
Discussion started by: guessingo
6 Replies
9. UNIX for Dummies Questions & Answers
Good morning, I need help to add number of occurence based on column 1 & column 5
file input
81161267334|1|100000|81329998077|20150902
81161267334|1|50000|82236060161|20150902
81161268637|1|25000|81329012229|20150911
81161269307|1|25000|81327019134|20150901... (3 Replies)
Discussion started by: radius
3 Replies
10. UNIX for Beginners Questions & Answers
So, I have three problems that cover this subject.
First one asks me to find the number of fields in the file that contain the substring "he". I found the number of fields, but the problem I have is that they are displaying by each record. I want to add all of the records' fields together.
With... (2 Replies)
Discussion started by: mc10
2 Replies