Processing input files

Processing input files

Post by rich seib » Mon, 30 Oct 1995 03:00:00




Quote:>Hi there,

>I'm have a short problem as follows.I have a file containing 4 columns, the
>first column conatining 5 letter strings in lower case and the remaining 3
>columns containing floating numbers. I want to convert all the strings in the
>first column from lower case to upper case. I know I could write a short C
>program to do this but is there a simpler way ie. using awk,tr,sed,etc? I'm
>very vaguely familiar with these tools but don't really know how to use them.
>Maybe somebody can give me the approximate command sequence.

There is a form of regular expression that is recognized by some
programs.  This is, it works on my vi or ex but not my sed, maybe yours.
The command is :%s/.* /\U&/
  which means, take any chars up to a space as the find string
               the \U says to upcase the next replacement string
               the & is the string found
 
 
 

Processing input files

Post by Bill Marc » Mon, 30 Oct 1995 03:00:00




Quote:

>For your specific case, you can try:

>cat file | sed '[a-z]' '[A-Z]' > newfile

You mean
cat file | tr '[a-z]' '[A-Z]' >newfile

--
"Goodness me, could this be industrial disease?"  Dire Straits

 
 
 

Processing input files

Post by Ray A. Jon » Wed, 01 Nov 1995 04:00:00



: >Hi there,
: >
: >I'm have a short problem as follows.I have a file containing 4 columns, the
: >first column conatining 5 letter strings in lower case and the remaining 3
: >columns containing floating numbers. I want to convert all the strings in the
: >first column from lower case to upper case. I know I could write a short C
: >program to do this but is there a simpler way ie. using awk,tr,sed,etc? I'm
: >very vaguely familiar with these tools but don't really know how to use them.
: >Maybe somebody can give me the approximate command sequence.

: There is a form of regular expression that is recognized by some
: programs.  This is, it works on my vi or ex but not my sed, maybe yours.
: The command is :%s/.* /\U&/
:   which means, take any chars up to a space as the find string
:                the \U says to upcase the next replacement string
:                the & is the string found

"tr" will translate lowercase to uppercase with:
tr "[a-z]" "[A-Z]" < infile > outfile

--

URL: http://www.celnotial.com         One Mercer Plaza, Suite S100
                                      Mercer Island, WA 98040; (206) 236-1676
Manufacturer of InterRack (Internet-in-a-Rack), a full turn-key
system, including all the hardware, software, installation, setup, training
and support for businesses and Internet Service Providers

 
 
 

1. Processing input files

: Does anyone know of any tools out there (commercial, shareware etc.) that will
: help in reading text input files?  We're coding up an application that must
: read ASCII text input files containing combinations of standard keywords.  We
: can do this with a giant switch statement in C but is there a better way?  The
: closest tools to what we require that we know about are 'Lex' and 'Yacc' but
: we wondered whether there were others available.  We'd certainly be grateful
: for any suggestions!

Sounds like you need to look at PERL.  Halfway between C and simple scripts,
it is likely the best language for your application, given that you already
know C.  

Good luck!

--

2. Running remote on Solaris from Windows

3. Redirecting input to a file - echo the input to screen/file?

4. syslog not working under NCR MP-RAS UNIX

5. How to get input from a file to come from output of a process?

6. Launch on double click, not single click

7. Can a parent process place input as stdin of child process?

8. New system, please help.

9. SAR processing multiple input files

10. standard input instead of input file

11. File input to variable input

12. How to input file to a executable file use csh?

13. updating shadow file from file input