Is there an easy way using bash INTERNALS to do the following:

Read in a file containing two numbers on one line separated by
space, and replace the whitespace between them with a ":"?

I'm trying to optimize some stuff in a script and trying to get
rid of awk/sed/perl calls that are unnecessary.

The input file contains:

2345 5678

I'd like something along the lines of:

DATA=${blahblash} < /somefile

Where ${blahblash} is one of the confusing bash constructs called
parameter expansion or whatever..

I just don't grok the bash manpage and the usage of parameter
expansion.

What I'd like though is this one liner to transform stdin from:

2345 5678 into: 2345:5678

The amount of whitespace in between the two numbers in the input
file may vary.  ie:

2345    5678

Any ideas?  I'm using the following right now:

DATA=$(sed 's/\W/:/' < inputfilename)

I want to lose that command substitution and "sed".  Command
substitution is ok though if it is a bash internal command.

TIA



-- 
Mike A. Harris                                     Linux advocate     
Computer Consultant                                  GNU advocate  
Capslock Consulting                          Open Source advocate

... Our continuing mission: To seek out knowledge of C, to explore
strange UNIX commands, and to boldly code where no one has man page 4.



_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

Reply via email to