I'm trying to add multiple numbers with varying length and with leading zeroes in it. However, I'm getting the sum (totalHashAccountNumber) without the leading zeroes in it. How do I retain the leading zeroes?
Please pardon the lengthy code.. I'm getting the hash account number from 2 different fields and do translation when there are non-numeric characters in the account numbers.
The length of totalhashAccountNumber may vary, at times, there are no leading zeroes in it.
I should have added this to my original post. The reason why I wanted the leading zeroes retained from the totalHashAccountNumber is that I will only need the first 10 digits from it. So from 07771636492, my final ouput will be 0777163649.
Hi,
I m new to shell scripting. I did some research and understand that unix treats while and other loops as new shell and hence the variable loose its value outside of the loop.
I found solution for integer variable but in mycase this is a string variable.
here variable loc is a... (6 Replies)
Hi All,
I have a requirement where there are 2 files saved on unix directory with names anil_111 and anil_222. I just have to retain the latest file and delete the old file from the directory.
Please help me with the shell script to perform this.
Thanks,
Anil (7 Replies)
There's an input file(input.txt) which has the following details :
CBA
BA
<Please note the second record has a LEADING WHITESPACE which is VALID>
I am using the following code to read the content of the said file line by line:
while read p ; do
echo "$p"
done < input.txt
This is the... (1 Reply)
Hi,
I wat to remove the first two columns of the ls -l command:
$ ls -l | awk '{ $1="";$2="";print;}'
The only problem is now the columns of the output is space separated instead of the separators the ls -l originally throws. Can someone tell how to preserve the default OFS of an ls -l... (3 Replies)
Retaining Spaces within a word
--------------------------------------------------------------------------------
Hi Experts,
I have a 2 GB flat file which have unicode field, some of them are blanks and its size is 4000 character. In the existing system SED command removes the spaces.... (7 Replies)
hi all,
Is there any way to retain file path?
echo "Please enter your old filename"
read a
#user input : /blah/blah1
echo "please enter the new filename"
read b
#user input : dumb
mv $a $b
What i would like to do is for the user to enter just the "filename" for the new filename... (2 Replies)
Hi Experts,
I have a 2 GB flat file which have unicode field, some of them are blanks and its size is 4000 character. In the existing system SED command removes the spaces. Because of this field itself....it is taking almost three days to complete the file processing. I removed sed and... (0 Replies)
Hi all,
I wrote a shell script in which one of the if condition i tried to set few variables and exported them...and when i am out of if condition i wish to run one of my script which uses those variables exported.
But i found that when i am out of the if statement those variables... (5 Replies)
gunzip fnam.tar.gz
After this command execution... .gz file no longer exists... and only fnam.tar is present.
Is it possible to retain the tar.gz file after after using the above command
thx in advance. (4 Replies)
Bourne shell
Solaris
I'm trying to set a flag to perform an action only when data is found. So I initialize the flag with:
X=0
Then I read the data:
if ; then
while read a b c
do
X=1
done < ${inputFile}
fi
The problem is that X will be set to 1 inside the while loop but when... (5 Replies)