Forget it.. Solved..

WORD1="Hello"
WORD2="There"
WORD3="`echo \"$WORD1          \" | cut -c -10`"
echo -n "${WORD3}$WORD2"

So no matter how long $WORD1 is, it's trimmed to 10 characters..




-----Original Message-----
From:   George Vieira [mailto:[EMAIL PROTECTED]]
Sent:   Saturday, February 24, 2001 9:00 PM
To:     '[EMAIL PROTECTED]'
Subject:        CUT
Importance:     High

Hi all,

Is there a way to get this to work without getting $WORD2 on the next
line...?


#!/bin/bash
WORD1="Hello"
WORD2="World"

echo -n "$WORD1                         " | cut -c -10
echo "$WORD2"

Problem here is that "cut" adds a CR at the end and there's no switch to
tell it not to.. so I end up with

Hello
World

and not
Hello     World

Any ideas on anothe method.. (please no loops, that take too long unless
someone codes C for me)...

thanks,
George.


-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to