Handling multiple fields of a database file for toupper() function in awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Handling multiple fields of a database file for toupper() function in awk
# 1  
Old 12-02-2009
Handling multiple fields of a database file for toupper() function in awk

hello everyone....

script is: To convert the contents of a database file into uppercase

my code is:
printf "%s\n" , $2 | awk '{print toupper($2)}' emp.lst

i m able to do only for one field.....didn't get any sources for handling multiple fields.

please suggest me for multiple fields...

Thanks in advance.
# 2  
Old 12-02-2009
Can you not use:

Code:
awk '{print toupper($0)}' emp.lst

Otherwise, for example:
Code:
awk '{$1 = toupper($1); $3 = toupper($3)}1' emp.lst

Or

Code:
tr '[a-z]' '[A-Z]' < emp.lst

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print multiple fields with awk

so its common knowledge one can print multiple fields with simple commands like this: echo 12 44 45 552 24 | awk '{print $1,$4,$3}' but suppose i want to avoid specifying the "$" symbol. is that possible? can something like this be done: echo 12 44 45 552 24 | awk '{print $(1,4,3)}' ... (9 Replies)
Discussion started by: SkySmart
9 Replies

2. Shell Programming and Scripting

awk to extract multiple values from file and add two additional fields

In the attached file I am trying to use awk to extract multiple values and create the tab-delimited desired output. In the output R_Index is a the sequential # and Pre_Enrichment is defaulted to .. I can extract from the values to the side of the keywords, but most are above and I can not... (2 Replies)
Discussion started by: cmccabe
2 Replies

3. Shell Programming and Scripting

awk multiple fields separators

Can you please help me with this .... Input File share "FTPTransfer" "/v31_fs01/root/FTP-Transfer" umask=022 maxusr=4294967295 netbios=NJ09FIL530 share "Test" "/v31_fs01/root/Test" umask=022 maxusr=4294967295 netbios=NJ09FIL530 share "ENR California" "/v31_fs01/root/ENR California"... (14 Replies)
Discussion started by: greycells
14 Replies

4. Shell Programming and Scripting

awk gsub multiple fields

Hi, I am trying to execute this line awk -F ";" -v OFS=";" '{gsub(/\./,",",$6); print}' FILE but for multiple fields $6 $7 $8 Do you have a suggstion? Tried: awk -F ";" -v OFS="";"" "function GSUB( F ) {gsub(/\./,\",\",$F); print} { GSUB( 6 ); GSUB( 7 ); GSUB( 8 ) } 1"... (2 Replies)
Discussion started by: nakaedu
2 Replies

5. UNIX for Dummies Questions & Answers

Awk Help - toupper/tolower

Hi, I am learning awk and faced few queries. Kindly suggest on the same. Where it is wrong. $ awk '{if (toupper($1) ~ /a/) print $0}' inv $ awk '{if (toupper($1) ~ /A/) print $0}' inv -- Why this output Jan 13 25 15 115 Mar 15 24 34 228 Apr 31 52 63 420 May 16 34 29 208... (6 Replies)
Discussion started by: vanand420
6 Replies

6. Shell Programming and Scripting

[SOLVED] Handling multiple files using awk

Hi, I am trying to process 2 files simultaneously using awk satisfying following condition, Both files contain 3 columns. It should take entry from column 1 from first file, look for that entry in file 2 and if found, add column 2 and column 3 from both files and output to third file. For e.g.... (4 Replies)
Discussion started by: muazfarooqaslam
4 Replies

7. UNIX for Advanced & Expert Users

awk function in handling quotes

Hi all, I have input lines like below empno,ename,sal,description ---------------------------- 311,"jone,abc",2000,manager 301,david,200,"president,ac" I need to sum the salary of them i.e. 2000+200 anything suggested Thanks, Shahnaz. Use code tags. (5 Replies)
Discussion started by: shahnazurs
5 Replies

8. Shell Programming and Scripting

handling multiple files using awk command and wants to get separate out file for each

hai all I am new to the world of shell scripting I wanted to extract two columns from multiple files say around 25 files and i wanted to get the separate outfile for each input file tired using the following command to extract two columns from 25 files awk... (2 Replies)
Discussion started by: hema dhevi
2 Replies

9. Shell Programming and Scripting

AWK multiple fields separators

I need to print the second field of a file, taking spaces, tab and = as field separators. ; for 16-bit app support MAPI=1 CMC=1 CMCDLLNAME32=mapi32.dll CMCDLLNAME=mapi.dll MAPIX=1 MAPIXVER=1.0.0.1 OLEMessaging=1 asf=MPEGVideo asx=MPEGVideo ivf=MPEGVideo m3u=MPEGVideo (2 Replies)
Discussion started by: PamPam
2 Replies

10. UNIX for Advanced & Expert Users

Multiple file handling

Dear All, I have two files, which looks like: File 1 124 235 152 178 156 142 178 163 159 File 2 124|5623 452|6698 178|9995 (8 Replies)
Discussion started by: rochitsharma
8 Replies
Login or Register to Ask a Question