Assigning any number to the variable in cshell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Assigning any number to the variable in cshell script
# 1  
Old 10-27-2015
Assigning any number to the variable in cshell script

Hello Guys,

I would like to ask you for a favor. Could you please help me how can I assign any number as the parameter to a, from stdin (-c), in the following command line by using the 'switch' in a script?

Code:
awk '$8>a {print "File name:" $5,$8}'

I would also appreciate if you can share any possibilietes how to add -h help button into the above script.

Thank you in advance for your kind help.

Padavan

Last edited by Don Cragun; 10-27-2015 at 09:14 PM.. Reason: Add CODE tags.
# 2  
Old 10-27-2015
Quote:
Originally Posted by Padavan
Hello Guys,

I would like to ask you for a favor. Could you please help me how can I assign any number as the parameter to a, from stdin (-c), in the following command line by using the 'switch' in a script?

Code:
awk '$8>a {print "File name:" $5,$8}'

I would also appreciate if you can share any possibilietes how to add -h help button into the above script.

Thank you in advance for your kind help.

Padavan
I'm lost:
  1. What does standard input have to do with "-c"?
  2. What language are you talking about?
    1. Are you saying you want to add code to your awk script to assign a value to the variable a?
    2. Do you have a shell variable that you want awk to use to assign a value to the awk variable named a?
  3. Is this awk script part of a shell script or are you writing a X application? (Or where is this help button supposed to be displayed?
  4. What operating system are you using?
  5. What shell (or command interpreter) are you using?
    1. Is switch part of the syntax of the command interpreter you're using?
    2. Do you mean you want to use a command-line option?
    3. Should your script have a default value for this variable that can be overridden by a command-line option?
  6. What is the format of the input file your awk script is reading?
  7. What is the name of the input file your awk script is reading?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Assigning an expression to a variable in shell script

i am trying to assign the following expression to a variable in Unix shell script and want to use that variable in some other expression. But unable to get the required thing done. Please help with this.... This is the expression which i want to provide as input the variable date '+%y:%m:%d' |... (3 Replies)
Discussion started by: ssk250
3 Replies

2. Shell Programming and Scripting

Assigning variable using script

Hi all, I have to write script to make my usual job easy. Basically it involve reading a output of following pattern: crab: ExitCodes Summary >>>>>>>>> 45 Jobs with Wrapper Exit Code : 0 List of jobs:... (10 Replies)
Discussion started by: emily
10 Replies

3. Shell Programming and Scripting

How to change a number on a specific line with cshell or shell?

Hello all, I need to change a number in a file by adding some residuals respectively To make it clear, I need to add 0.11 to the number between 24-28 (which is below the SECON) for all the lines starting with FRR1 or I need to add 0.13 to the number between 24-28 (which is below the... (9 Replies)
Discussion started by: miriammiriam
9 Replies

4. Shell Programming and Scripting

Script stops running after assigning empty string for a variable

Hi, This is the first time I see something like this, and I don't why it happens. Please give me some help. I am really appreciate it. Basically I am trying to remove all empty lines of an input.. #!/bin/bash set -e set -x str1=`echo -e "\nhaha" | grep -v ^$` #str2=`echo -e "\n" |... (4 Replies)
Discussion started by: yoyomano
4 Replies

5. Shell Programming and Scripting

Assigning value to script variable

I am trying to assign the value returned by wc command to a script variale. Code: FILES_NAME='files_list'; NO_OF_FILES =${wc -l $FILES_NAME}`; When the above code is run : it throws the error ${wc -l $FILES_NAME}: The specified substitution is not valid for this command. what is the... (6 Replies)
Discussion started by: hiten.r.chauhan
6 Replies

6. Shell Programming and Scripting

Assigning return value of an embedded SQL in a shell script variable

I've a script of the following form calling a simple sql that counts the no of rows as based on some conditions. I want the count returned by the sql to get assigned to the variable sql_ret_val1. However I'm finding that this var is always getting assigned a value of 0. I have verified by executing... (1 Reply)
Discussion started by: MxC
1 Replies

7. Shell Programming and Scripting

ksh help assigning specific values to variable in script

Hi - Help needed. I have an input file that looks something like this, but with a lot more entries: A Customer1 B 4500 C 8000 A Customer2 B 6422 C 8922 I need to be able to print details for each customer on one line per customer. ie. if I could print these to a file and then cat... (3 Replies)
Discussion started by: frustrated1
3 Replies

8. Shell Programming and Scripting

Removing a character from a variable and assigning it to another variable?

Hi folks. I have this variable called FirstIN that contains something like this: 001,002,003,004... I am trying to assign the content of this variable into ModifiedIN but with the following format : 001 002 003 004...(changing the commas for spaces) I thought about using sed but i am not... (17 Replies)
Discussion started by: Stephan
17 Replies

9. Shell Programming and Scripting

Assigning number of days in the month to a variable

I am writing a script that requires the number of days in any given month. In the shell, I can use the command: cal `date +%m` `date +%Y`| grep -v '' | wc -w to give me the number of days in the month, but when I assign it to a variable: VAR=`cal `date +%m` `date +%Y`| grep -v '' | wc... (3 Replies)
Discussion started by: skaptakalian
3 Replies

10. UNIX for Dummies Questions & Answers

number of occurence using grep -c then assigning it to a variable

Hi guys! I need to count the occurence of a certain pattern. For example the pattern is PC. the contents of the file sample.txt: A PC asdfgadfjkl asdfa PC sadfaf fdsPCasdfg if i use grep -c PC sample.txt it will display 3 as the number of occurence how do i save that number to a... (1 Reply)
Discussion started by: khestoi
1 Replies
Login or Register to Ask a Question