Using df -g command with awk to get SQL statement

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Using df -g command with awk to get SQL statement
# 1  
Old 06-02-2017
Using df -g command with awk to get SQL statement

Hi Gurus... good day;

currently I trying to run the df -g command with awk to get to convert in SQL statement, but I have some errors;

Code:
df -g | awk '{print "This is the FileSystem: " $NF, " This is LV: "$1, "This is SIZE: "$2, "This is FREE: " $3, "This is the USED% "$4}'

This on AIX operative system;

But I need replace the words This is the..., but I dont know how to...กก

Some can help me..

best regards;

Wilmer
Moderator's Comments:
Mod Comment This thread has been moved here from a different thread started to discuss an unrelated topic. This post was also duplicated in another thread that it hijacked.

Please use CODE tags (ass required by forum rules) when displaying sample input, sample output, and code segments.

Last edited by Don Cragun; 06-02-2017 at 09:34 PM.. Reason: Add CODE and ICODE tags; note that this thread was created from posts in two other hijacked threads.
# 2  
Old 06-02-2017
Quote:
Originally Posted by wcastibl
Hi Gurus... good day;

currently I trying to run the df -g command with awk to get to convert in SQL statement, but I have some errors;

df -g | awk '{print "This is the FileSystem: " $NF, " This is LV: "$1, "This is SIZE: "$2, "This is FREE: " $3, "This is the USED% "$4}'

This on AIX operative system;

But I need replace the words "This is the...", but I dont know how to...กก

Some can help me..

best regards;

Wilmer
Once again - open your own thread AND don't double-post!
# 3  
Old 06-02-2017
I fail to understand your problem. If you wrote the code:
Code:
df -g | awk '{print "This is the FileSystem: " $NF, " This is LV: "$1, "This is SIZE: "$2, "This is FREE: " $3, "This is the USED% "$4}'

surely you should be able to figure out that you could instead write the code:
Code:
df -g | awk '{print "Some Other Text FileSystem: " $NF, " This is LV: "$1, "This is SIZE: "$2, "This is FREE: " $3, "Some Other Text USED% "$4}'

to replace the words This is the with whatever other text you prefer. And, I fail to see what any text you might put in those two places in your awk script has to do with SQL.

Please clearly explain what you are really trying to do.
# 4  
Old 06-03-2017
I think it would help us to help you if:
Code:
1. you told us what you want to accomplish, the goal you want to achieve.
2. you do not tell us how you want to do it.  Forget that part completely. It is really confusing and possibly wrong.

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert Update statement into Insert statement in UNIX using awk, sed....

Hi folks, I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex. I have a bunch of update statements with all columns in a file which I need to convert into insert statements. UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies

2. Shell Programming and Scripting

How to add printf statement in awk command?

hi all i need to add the prinf statement in awk command for the converted comma separated output.... below is my code : Code Credits :RudiC awk -F, 'NF==2 {next} {ITM=$1 AMT=$2+0 CNT=$3+0 TOTA+=$2 ... (4 Replies)
Discussion started by: hemanthsaikumar
4 Replies

3. Shell Programming and Scripting

Command in inside awk statement

Hello can you please help me with below script which is meant to delete clients from multiple netbackup policies I want to run a command insdie awk statement apparelnlty this script is not working for me for i in $( cat clients_list) do bppllist -byclient $i | awk... (6 Replies)
Discussion started by: Sara_84
6 Replies

4. Shell Programming and Scripting

UNIX variable to SQL statement

The following is my script : #!/bin/bash echo "please give app_instance_id" read app_instance_id echo "id is $app_instance_id" export app_id=app_instance_id sqlplus -s nnviewer/lookup@//nasolora008.enterprisenet.org:1521/LOAD3 @test.sql<<EOF SPOOL /home/tibco/MCH/Data/qa/raak/name.xls... (4 Replies)
Discussion started by: raakeshr
4 Replies

5. Shell Programming and Scripting

issues with sql inside if statement

Hi, I have problem with the following code. My IF block is not executed. And I see "syntax error near unexpected token `)'" error for line "EOF" in the stats_function(). but when I comment the IF block I don't see this error. Kindly help me with this issue. clean_function() {... (10 Replies)
Discussion started by: babom
10 Replies

6. Shell Programming and Scripting

Read SQL statement in Script

Hi Guys.. need some urgent help... I am stuck in something badly I need to write a script which would read a sql statement (which might be a join/inner join/select/sub select etc. ) I need to read that sql statement ... and in the output I want all the table names and columns (doesn't... (4 Replies)
Discussion started by: freakygs
4 Replies

7. Shell Programming and Scripting

Unix shell command output to a sql statement

Can i do this Say one command sed 's/:*/ /g' $summf is returning C1234 C2345 C3434 some no of rows, now this ouput i have to insert it into a DB table how do i do this?? (2 Replies)
Discussion started by: depakjan
2 Replies

8. Shell Programming and Scripting

Rerun sql statement

Hi, Script that I wrote only run sql query once then exit. But my requirement, I want the query can be execute a couple of time without exiting the script. How could I do it? Thanks. (1 Reply)
Discussion started by: killboy
1 Replies

9. Shell Programming and Scripting

How to convert unix command into Awk statement

Hi all, How can i use the below unix command in AWK . Can any one please suggest me how i can use. sed -e "s/which first.sh/which \$0/g" $shell > $shell.sal where $0=current program name(say current.sh) $shell=second.sh (1 Reply)
Discussion started by: krishna_gnv
1 Replies

10. Shell Programming and Scripting

awk command for INSERT statement

Hi, I sometimes bulk upload data in oracle. The problem is that I sometimes get an INSERT statemnt like this: INSERT INTO ALL_USER_HOTSPOT_DETAILS (USR_LOGIN,USR_LASTNAME,USR_FIRSTNAME,USR_EMAIL, PROPERTYNR) VALUES ('SABRDAG','D'AGOS','SABRINA','sabrina_d'agos@sheraton.com',70) I... (4 Replies)
Discussion started by: nattynatty
4 Replies
Login or Register to Ask a Question