Unfortunately ${var:offset} is not available in ksh88
Quote:
Originally Posted by rbatte1
To smile689,
vidyadhar85 has the best solution as it does not spawn another process. If you have a lot of data to process, spawning a process each time can be very time consuming. If you shell doesn't quite like his syntax (or you want something similar, but in just ksh) you can use this slightly messier one:-
[..]
Good solution, if you add double quotes the subsitution gets protected from possible special characters in the replacement string :
--
(still thanks for that, @alister)
Last edited by Scrutinizer; 06-26-2013 at 03:39 PM..
This User Gave Thanks to Scrutinizer For This Post:
I want to grep from a file an exact character match.
I tried grep -c "$a $b" $file
where a=6 and b=2
the problem is that I get: 6 2 and 6 20
I just need a count of the occurrence.
I'm using the Bourne shell.
I've also tried grep -c '$a $b' $file;
not sure how to do this - any suggestions? (3 Replies)
Hi Folks,
I have this windowed applescript application I use for sending out emails, it uses the Postfix daemon buit into my Mac Os X box, and a 3 SMTP servers (out of hundreds I send emails to) were refusing my messages replying "host smtp2.braspress.com.br said: 550 Requested action not... (2 Replies)
Please help. This simple problem is really stumping me.
Is there are way to find absolute pathnames for all files on your system that are longer than 100 characters?
I'm using bash shell to attempt it, but have come up with nothing so far.
I appreciate any help offered.
Nauty (2 Replies)
I have a file sample.txt with the below contents:
Aaa - providioning add ||
dev - reeec
dev kapl ||
ball - HERO ||
bal - provisioning pro ||
for given name i need the output to be the contents between - and || (excluding both)
for eg : input - Aaa
output -... (10 Replies)
Hi,
Is there anyway to find the junk characters in a file.Consider the file has data as given below:
123|abc^M|Doctor^C #record 1
234|def|Med #record 2
345|dfg^C|Wrong^V #record 3
The junk characters are highlighted and this is a pipe delimited file.
Is there anyway to... (20 Replies)
Hi, I have a series of files (upwards of 500) the filename format is as follows
CC10-1234P1999.WGS84.p190
each of this files is in a directory named for the file but excluding the extension.
Now the last three numeric characters, in this case 999, can be anything from 001 to 999, I need to... (3 Replies)
Hi, I have a series of files (upwards of 500) the filename format is as follows
CC10-1234P1999.WGS84.p190, all in one directory.
Now the last three numeric characters, in this case 999, can be anything from 001 to 999.
I need to move some of them to a seperate directory, the ones I need to... (5 Replies)
After spending sometime playing around with my script I just cannot get it to do what I want. So I decided to ask. My file looks something like this:
I am using the following code to extract sequences that contain dashes
awk '/^>/{id=$0;next}{if (match($1,"-")) print id "\n" $0}' infile
... (17 Replies)
Hi All,
Assuming i have got a file test.dat which has contains as follows:
Unix = abc def fgt jug
111 2222 3333
Linux = gggg pppp qqq
C# = ccc ffff llll
I would like to traverse through the file, get the 1st occurance of "=" and then need to get the sting... (22 Replies)
Hi....I need one help....
I'm having a files which is having the data as follows...
a
b
c c
d d d
e
f
Now I need to find out distinct characters from this file and the output should be as follows -
a
b
c
d
e
f
Can you please help me on this? I'm using KSH script. (18 Replies)