help needed in variable assignment


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help needed in variable assignment
# 1  
Old 05-11-2007
help needed in variable assignment

Hi all,

I am having some value in feedrow in my script.
And want to assign first three character in to DTYPE.
I am using following syntax.

DTYPE=`$FEEDROW|cut -c 1-3`

But it's not assigning this valuse into DTYPE.

Please suggest.
Its really uegent.

Regards,
Gander_ss
# 2  
Old 05-11-2007
Code:
DTYPE=`echo  $FEEDROW|cut -c 1-3`

Code:
DTYPE=${FEEDROW%${FEEDROW#???}}

# 3  
Old 05-11-2007
Thanks!!!!!!!!!!!!!!!!!!!!!!!!!
It's working....... Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Variable Assignment

Hi I am facing a problem. export local_folder=/opt/app/ cd /opt/app/abc/ abcversion="abc*" (abcga5 is inside /opt/app/abc/) echo $abcversion (it echoes the correct version as abcga5 ) Now when I reuse the value of abcversion for a below path: export... (6 Replies)
Discussion started by: ankur328
6 Replies

2. Shell Programming and Scripting

Same Variable Assignment

Hi I have a strange problem: In my shell script I am performing a copy task: . prop.txt cp -r $dir/ $dir/archive $dir is fetched from a property file (prop.txt) which stores its value dir=/opt/data Now the problem is another dir1 comes into picture. I only want to add... (1 Reply)
Discussion started by: ankur328
1 Replies

3. Shell Programming and Scripting

Assignment with variable assigment

Hello All, I'm trying to assign integer values to variables using substitution in both the value and variable's name, i.e., number$x=$x where x is equal to one in the first assignment, two in the second assignment, and so on with x being incremented each time. However, when I do the... (7 Replies)
Discussion started by: tombombadil
7 Replies

4. UNIX for Dummies Questions & Answers

Regex and variable assignment

Hi there, I really didn't want to have to waste people's time and ask this, but after 2 hours and running out of my own time I've decided to ask.. Basically I have a file in the format: word: other words; more words here; last word word: more words here; last word (etc) x 100 Where the... (3 Replies)
Discussion started by: maximus73
3 Replies

5. Homework & Coursework Questions

help needed for an assignment script

1. The problem statement, all variables and given/known data: Hi, please advise a script/c program for following: write program p1 which will create shared memory to hold an integer value and will create One child process inside child process run another program say p2 .now p2 will... (1 Reply)
Discussion started by: fed.linuxgossip
1 Replies

6. Shell Programming and Scripting

help needed for an assignment script

Hi, please advise a script/c program for following: write program p1 which will create shared memory to hold an integer value and will create One child process inside child process run another program say p2 .now p2 will continuousiy assign value 15 to shared memory created by p1. Program p1... (1 Reply)
Discussion started by: fed.linuxgossip
1 Replies

7. Shell Programming and Scripting

Help with variable assignment

Hi, In AIX I have a variable with , (coma) separated values assigned to it like shown below var1=apple,boy,chris i want to convert this to var1='apple','boy','chris' the number of values assigned to var1 might change and it could be from 1 to n any suggestions please? (3 Replies)
Discussion started by: rahul9909
3 Replies

8. Shell Programming and Scripting

variable assignment using awk

Guys, Could you please help me out. I need two values in two variables using awk from the o/p of grep. example:- grep sdosanjh <filename> sdosanjh myhostname myfilename NOW WHAT I WANT IS :- sdosanjh should be in variable (say NAME) myhostname should be in variable (say... (8 Replies)
Discussion started by: sdosanjh
8 Replies

9. Shell Programming and Scripting

Variable assignment question

Hello, I would like to assign number of lines in a file to a variable (to be passed later as an argument to a function). I am doing it like this: numLines=wc -l < file.txt which gives an error. Could somebody help? (2 Replies)
Discussion started by: DDD
2 Replies

10. UNIX for Dummies Questions & Answers

@ in a variable assignment

Hello Everybody, Does anyone know what the @ symbol means in a csh script, if used with a variable assignment as below @ line = 1 why not just use.... set line=1 Many thanks rkap (1 Reply)
Discussion started by: rkap
1 Replies
Login or Register to Ask a Question