String operations

String operations
# 1
07-13-2011
String operations

Hi All,

can you tell me how to drop all preceding zeros in a number. For example, if i have a numbers like 000876838347 and 0000007854762543..how to make them as 876838347 and 7854762543.
 nram_krishna@ya View Public Profile for nram_krishna@ya Find all posts by nram_krishna@ya
# 2
07-13-2011
 Corona688 View Public Profile for Corona688 Visit Corona688's homepage! Find all posts by Corona688
# 3
07-13-2011
bash \$(())
This User Gave Thanks to neutronscott For This Post:
 neutronscott View Public Profile for neutronscott Visit neutronscott's homepage! Find all posts by neutronscott
# 4
07-13-2011
Problem with numerical operations is most things assume numbers beginning in zero are octal.
This User Gave Thanks to Corona688 For This Post:
 Corona688 View Public Profile for Corona688 Visit Corona688's homepage! Find all posts by Corona688
# 5
07-13-2011
Here is a solution without numerical operations:
This User Gave Thanks to Shell_Life For This Post:
 Shell_Life View Public Profile for Shell_Life Find all posts by Shell_Life
# 6
07-14-2011
Thanks a bunch! its worked..
 nram_krishna@ya View Public Profile for nram_krishna@ya Find all posts by nram_krishna@ya
# 7
07-14-2011
If you have ksh93 then you can use builtin regexp
Or

Last edited by kshji; 07-14-2011 at 01:14 PM..
 kshji View Public Profile for kshji Find all posts by kshji

File Operations

Hi Folks, Below is example of an Input data which is used, based on the last 2, 3 & 4 column, I want my first column data to be collated as shown in the output section. a,ac,tc,ic b,ac,tc,ic c,ac,tc,ic d,ac,tc,ic b,bc,tc,ic d,bc,tc,ic e,bc,tc,ic I want my output to be ...

Shell operations from C++

Hi everyone, I need little help in shell operations from C++ program. Here I furnish the details of problem: 1. Lets say my current working path is myWorkingPath. 2. In my working path I have list of name directories and each name directory has two more sub directories say A/B. (now path to...

Atomic Operations

Hello I am a newbie in linux. Please tell me what are atomic operations in Linux. IS i++ a atomic oparation?? Please help..

shell cursor operations

Hi I need to save the actual cursor position into variable in my script. How can I do it ? thx for help.

String operations

Can you give me some suggestions to split below string into three parts using shell scripts.. Script has to print all alphabets before the number, then number and then all alphabets after the number.. input: chris martin 200173 845747 mech engineer output: chris martin 200173 845747 mech...

Help on shell script (string operations)

Hey everyone. So the background of the problem is that the ps3 does not support the mkv container, but DOES support the avi one. Here is the script to convert one file with the name hardcoded in: #!/bin/sh mencoder -oac...

AlphaNumeric String Operations

Hi :) I am writing a ksh I have a string of general format A12B3456CD78 the string is of variable length the string always ends with numbers (here it is 78.. it can be any number of digits may be 789 or just 7) before these ending numbers are alphabets (here it is CD can even be...

File operations

Hi I have a tab delimited file with 3 fields. I need to sort this file on the first field and remove all the records where the first field has dulplicates. For eg my file is 133|arrfdfdg|sdfdsg 234|asfsdgfs|aasdfs 133|affbfsde|dgfg When this file gets sorted I need the result to be ...

String Operations

Hi All, Query 1 : I want to know how we can get a count of multipe occurrences of a particular expression in another string. For Eg. If my string is " 12" and i need to count the number of spaces preceeding 12 Query 2 : Also want to know how we can change the alignment of a...

File operations

Hi there, I want some help on scripting regarding file processing. I have a scenario in which I have 10 files. (file1.txt, file2.txt....) and they are in paricular format. I want to read these files and append some text lines at the begining of each file and write this updated contents of...