It would be nice to know what context you are trying to do this in. As has been suggested, if you have a file of first and last names, just run a sed across the file. However, if you have a string, or two tokens, as a part of a loop in a programme, then the answer will be different. As an example, if you are working in ksh or bash this is much more efficient than running sed for each individual string:
If you need E.C. or E. C. you can do something like this:
---------- Post updated at 11:23 ---------- Previous update was at 11:16 ----------
Crossed posts with you...
Again, if you're using a Ksh like shell language, then you could just echo out the first characters like this:
Hi,
I have a requirement like i have to find out files and remove them on a daily basis.
The files are generated as
abc_jnfn_201404230004.csv
abc_jnfo_201404230004.csv
abc_jnfp_201404230004.csv
abc_jnfq_201404230004.csv
abd_jnfn_201404220004.csv
abe_jnfn_201404220004.csv
i want to... (1 Reply)
I have this code that works great ...
#!/bin/sh
for file in "$@"
do
ext=${file##*.}
base=${file%.*}
num=${base##*v}
zeroes=${num%%*}
num=${num#$zeroes} #remove leading zeros, or it uses octal
num=$((num+1))
base=${base%v*}
... (5 Replies)