Need Help in Cutting a word


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need Help in Cutting a word
# 8  
Old 09-23-2008
Can you try with the below, it will return the Server name(Even if it get change).

Code:
uname -n

# 9  
Old 09-23-2008
Quote:
Originally Posted by palsevlohit_123
Can you try with the below, it will return the Server name(Even if it get change).

Code:
uname -n


Thankyou!!! both of my executable is located in the same server .. let say i installed the executable in on location , can it be accessed from a different path using links .. i tried the same but it says "file is not found ""

Thanks!!
# 10  
Old 09-23-2008
you can use a command "uname" on SunOS.

uname -n will display the servername you are logged on.

Eg. abc@server

server_name=`uname -n`
user_name=`echo "user@$server_name" | cut -d"@" -f1`

echo "$user_name $server_name"

OUTPUT:
abc server

Now this can easily be used within a script.
# 11  
Old 09-24-2008
Quote:
Originally Posted by mk1216
you can use a command "uname" on SunOS.

uname -n will display the servername you are logged on.

Eg. abc@server

server_name=`uname -n`
user_name=`echo "user@$server_name" | cut -d"@" -f1`

echo "$user_name $server_name"

OUTPUT:
abc server

Now this can easily be used within a script.

Great Thanks !!!
Is there a way to call a executable by creating a link .. this is the problem which i am right now facing .. if any one help on me on this .. it would great .. because i created a link as well which also didnot work

Thanks again!!!
# 12  
Old 09-24-2008
LINK ------does this mean softlink ? then it works .

Try :
ln -s <absolute_dir_path>/<script_name> <soft_link_name>

Eg:
ln -s sript/to/run/test.ksh myscript

and then you can directly call "myscript" from command line to run the script.

Is this what you were looking for .
# 13  
Old 09-25-2008
Thanks it worked !!!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to search for a word in column header that fully matches the word not partially in awk?

I have a multicolumn text file with header in the first row like this The headers are stored in an array called . which contains I want to search for each elements of this array from that multicolumn text file. And I am using this awk approach for ii in ${hdr} do gawk -vcol="$ii" -F... (1 Reply)
Discussion started by: Atta
1 Replies

2. Shell Programming and Scripting

Find a word and increment the number in the word & save into new files

Hi All, I am looking for a perl/awk/sed command to auto-increment the numbers line in file, P1.tcl: run_build_model sparc_ifu_dec run_drc set_faults -model path_delay -atpg_effectiveness -fault_coverage add_delay_paths P1 set_atpg -abort_limit 1000 run_atpg -ndetects 1000 I would like... (6 Replies)
Discussion started by: jypark22
6 Replies

3. Shell Programming and Scripting

Search for the word and exporting 35 characters after that word using shell script

I have a file input.txt which have loads of weird characters, html tags and useful materials. I want to display 35 characters after the word "description" excluding weird characters like $&lmp and without html tags in the new file output.txt. Help me. Thanx in advance. I have attached the input... (4 Replies)
Discussion started by: sachit adhikari
4 Replies

4. Shell Programming and Scripting

AWK Substring without cutting off word

Can someone help me to make this code without cutting off words ni the string? awk '{for(i=1;i<length;i+=100) print substr($0,i,100)}' Thank you! (4 Replies)
Discussion started by: sanantonio7777
4 Replies

5. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

6. Shell Programming and Scripting

Perl Cutting character(s) from a word

Hello, How to cut a char(s) for a word using perl?? I want to cut the number(s) from these sample words: Port-channel24 Po78 Po99 Port-channel34 $word = "Port-channel24"; I want to put only the number in a varible. Appreaciate using simple way in order to use it... (3 Replies)
Discussion started by: ahmed_zaher
3 Replies

7. Shell Programming and Scripting

To read data word by word from given file & storing in variables

File having data in following format : file name : file.txt -------------------- 111111;name1 222222;name2 333333;name3 I want to read this file so that I can split these into two paramaters i.e. 111111 & name1 into two different variables(say value1 & value2). i.e val1=11111 &... (2 Replies)
Discussion started by: sjoshi98
2 Replies

8. Shell Programming and Scripting

How to cut first line only from a text near a specific column without cutting a word

First I have to say thank you to this community and this forum. You helped me very much builing several useful scripts. Now, I can't get a solution the following problem, I'm stuck somehow. Maybe someone has an idea. In short, I dump a site via lynx and pipe the output in a file. I need to... (7 Replies)
Discussion started by: lowmaster
7 Replies

9. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies

10. UNIX for Dummies Questions & Answers

cutting

Is there any cut or awk function that would allow me to take the last part of a path away and save the list into a file? I wrote: find $HOME -mtime +3 > fileList cat fileList /home/102/s/jn/folder/HW /home/102/s/jn/otherfolder/B.txt /home/102/s/jn/folder4/3dA/w... (1 Reply)
Discussion started by: terms5
1 Replies
Login or Register to Ask a Question