Editing String in std-in

A

Arijit Mukherjee

Hi,
I have a scenario - wherein I need to read entries from the stdin -
do some processing on the same - and then provide the contents on the
std-in the same manner - with just the last character deleted - so that
whatever is given back is editable. How do I do the same?
Thanks in anticipation,
Regards,
Arijit
 
C

Chuck

Hi,
I have a scenario - wherein I need to read entries from the stdin -
do some processing on the same - and then provide the contents on the
std-in the same manner - with just the last character deleted - so that
whatever is given back is editable. How do I do the same?
Thanks in anticipation,
Regards,
Arijit

Why not just write to stdout and have the next program read that output as
it's input? This is straight forward unix filtering. To remove the last
character, sed or awk can do the trick.
 
D

Dan Pop

In said:
I have a scenario - wherein I need to read entries from the stdin -
do some processing on the same - and then provide the contents on the
std-in the same manner - with just the last character deleted - so that
whatever is given back is editable. How do I do the same?

Could you explain, by what kind of logic have you decided that this
question should be crossposted to comp.unix.shell and comp.lang.c?

Anyway, the c.l.c answer is that you cannot portably push back more
than one character to any stream, stdin included.

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,951
Messages
2,570,113
Members
46,698
Latest member
alexxx

Latest Threads

Top