awk command - not a valid identifier message


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk command - not a valid identifier message
# 1  
Old 09-12-2011
awk command - not a valid identifier message

Trying to run the following awk command :
Code:
export com.mics.ara.server.tools.sch_reports.Runner.num_threads=`awk -F= '!/^#/ && /com.mics.ara.server.tools.sch_reports.Runner.num_threads/{print $2}' $BKUPDIR/env.properties`
 
-bash: export: `com.mics.ara.server.tools.sch_reports.Runner.num_threads=': not a valid identifier

but i'm getting the following error message as per above ?

Last edited by vbe; 09-12-2011 at 12:29 PM.. Reason: code tags
# 2  
Old 09-12-2011
1. Try:
Code:
com.mics.ara.server.tools.sch_reports.Runner.num_threads=1

2. Think about the result.
3. Learn the basics of the shell.
# 3  
Old 09-12-2011
ok my question is :

I have a value within a file :

Code:
aaa.ddd.ccc.ddd.eee.fff=5

how do I create a variable from the above line so I can pass it to another file. But I only need the value 5 as the variable.

thank you

Moderator's Comments:
Mod Comment Please use code tags!

Last edited by radoulov; 09-12-2011 at 01:01 PM..
# 4  
Old 09-12-2011
Code:
$ echo "aaa.ddd.ccc.ddd.eee.fff=5" | awk '{ split($0, A, "="); printf("var=%s\n", A[2]); }'
var=5
$

# 5  
Old 09-12-2011
thank you, now if my line is this below
Code:
 
com.data.ara.reportserver.tools.sch_reports.ReportRunner.num_threads=5

how would I do this ?

Last edited by vbe; 09-12-2011 at 01:11 PM.. Reason: code tags!!! You have been warned...
# 6  
Old 09-12-2011
why don't you apply the same logic as above and try out?

--ahamed
# 7  
Old 09-12-2011
Quote:
Originally Posted by venhart
thank you, now if my line is this below
Code:
 
com.data.ara.reportserver.tools.sch_reports.ReportRunner.num_threads=5

how would I do this ?
Exact same way. It splits on '=' so it ignores everything before the =.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[BASH] (own) command is not a valid identifier

Heya fellows Yes, script-tools and TUI are both my 'children', so i cant go anywhere (else) and ask for help/bugfixes as i need to write them myself. However i do need help to understand error messages at times (or get hints what else might cause them), so here we go: Since my new computer... (4 Replies)
Discussion started by: sea
4 Replies

2. Shell Programming and Scripting

0403-009 The specified number is not valid for this command

Hi, Am using a if condition to match a pattern but I get the following error.. if then echo "The value is $hidType" return 0 elseif -a ] echo "The value is $hidType" return 0 fi I get the following error + echo The value is mode The value is mode + ./a2: mode:... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

3. Shell Programming and Scripting

Using awk to determine if field value is valid

Hi Forum. I tried to search the forum posts for an answer but I haven't been able to do so for what I'm trying to accomplish. I have the following source file: 11936385~TFSA|11936385|4431|3401458067|10/09/1982|25.00|IBSBONUS|3200|||||CASH| 3401458067|1005|... (3 Replies)
Discussion started by: pchang
3 Replies

4. Shell Programming and Scripting

A test command parameter is not valid

Hello, Getting error "A test command parameter is not valid" when trying to run the code below under /sbin/sh AA = "12:00" CHK=$(date +"%H:%M") if then print "Yes" fi Getting 2 errors: 1) "AA: not found" 2) "Specify a parameter with this command" Thanks, IS Please... (5 Replies)
Discussion started by: schureki
5 Replies

5. Shell Programming and Scripting

Whether a string is a valid unix command

How to find a string which is entered in command promt is a valid unix command or not?. Thanks in advance ~Saravana (2 Replies)
Discussion started by: tsaravanan
2 Replies

6. Shell Programming and Scripting

how to judge wether a url is valid or not using awk

rt 3ks:confused: (6 Replies)
Discussion started by: rainboisterous
6 Replies

7. Shell Programming and Scripting

': not a valid identifier

I am trying to write a bash script. I am able to do simple things like pass arguments, assign variables and echo the results. However, when I try to declare and array or anything a little more complicated I get ': not a valid identifier Here is my code so far: #!/bin/bash echo start t... (7 Replies)
Discussion started by: script123
7 Replies

8. Shell Programming and Scripting

Help regarding Error message: A test command parameter is not valid

Hi I am getting few messages when trying to run my script from the following lines in the script if test then // SomeCode fi The messages are as follows: testing.sh: OBLIGOR_GROUP_ID: 0403-012 A test command parameter is not valid. testing.sh:... (5 Replies)
Discussion started by: skyineyes
5 Replies

9. UNIX for Dummies Questions & Answers

SED or AWK: Appending a line Identifier that changes with paragraph?

Have another question that has been eluding me all day. I have data file I'm trying to reformat so that each line is appended with an ID code, but the ID code needs to update as it searches through the file. I.e. ----Begin Original Datafile----- Condition = XXX Header Line 1 Header... (1 Reply)
Discussion started by: selkirk
1 Replies

10. UNIX for Dummies Questions & Answers

pwd: A specified flag is not valid for this command.

Probably a very straight forward question but please be easy on me, I am v. new to UNIX! A script that I have runs the line tmp=`pwd -H` It works fine, but I needed to make a couple of other changes to the script, nowhere near this line but now this line reports: pwd: A specified flag... (2 Replies)
Discussion started by: Paxton
2 Replies
Login or Register to Ask a Question