Small help in scripting !!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Small help in scripting !!!
# 1  
Old 10-22-2010
MySQL Small help in scripting !!!

Hi all,

I have a script in which line like this ..
Code:
linux_ver="RHEL$(cat /etc/redhat-release | awk '{print $7}')"

Result is
Code:
linux_ver=RHEL5.3

But i want the o/p to be linux_ver=RHEL5 (discard ".3" or what ever comming after 5)

please help me out

Thanks in advance
Renjesh Raju

Moderator's Comments:
Mod Comment You got so many posts - you should be familiar using code tags - please do so. You got a PM.
# 2  
Old 10-22-2010
Code:
$> linux_ver="RHEL$(cut -d. -f1 /etc/redhat-release)"
$> echo $linux_ver
RHEL5

# 3  
Old 10-22-2010
Sorry i am not getting the exact output ...


# linux_ver="RHEL$(cut -d. -f1 /etc/redhat-release)"
root@st95esrn [/tmp/issuance_src/Linux/products]
# echo $linux_ver
RHELRed Hat Enterprise Linux Server release 5
# 4  
Old 10-22-2010
Code:
linux_ver=`RHEL$(cat /etc/redhat-release | awk '{print $7}') | awk -F "." '{print $1}'`

echo "linux_ver="$linux_ver

Just added another awk part to your code!.
Try it.
# 5  
Old 10-22-2010
Thansk a lot
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Small Assignment

1. Write a menu driven shell program to a. Display calendar of current month. b. Search for a pattern in all the files/subdirectories from current directory. c. Count the no. of directories / sub directories in current directory. 2. Display day of week for a given date. (ddmmyyyy).... (4 Replies)
Discussion started by: jainitai
4 Replies

2. Shell Programming and Scripting

need a small help

Hi, sorry for inconvenience..wrong query posted. Thanks for your help. Thanks (1 Reply)
Discussion started by: kirankumar
1 Replies

3. Shell Programming and Scripting

Need small help

Hi all, I have two files in my folder 1.index.jsp 2.maintenance.jsp Once hit the URL in IE,It will call the index.jsp file than application working fine. I want to some maintenance in my application, during the application maintenance than it will... (1 Reply)
Discussion started by: lkeswar
1 Replies

4. Shell Programming and Scripting

Need small help

Hi, i have a client requirement to post the files into generic folder named as "source".file identification is to retrieve Publication code (Instance name) from the file name.So thereafter we move the files to different instances of specific folders for the same unix server.(means if the file... (2 Replies)
Discussion started by: kirankumar
2 Replies

5. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

6. UNIX for Advanced & Expert Users

Two small queries

Query 1 : How to check if a directory already exists? If doesn't exist then create a new one. Query 2 : I want to put following text using a single echo statement into a log file and also want to retain the formatting of the text. How it can be... (3 Replies)
Discussion started by: skyineyes
3 Replies

7. Shell Programming and Scripting

few small scripting questions

hello everyone, i have a couple of questions about programming with shell scripts. -My question is, how do you find out how long a sequence of numbers that has just been entered is. for example If i enter 12345 the length here is 5 and 23456789 the length here is eight. I want to be able... (1 Reply)
Discussion started by: bebop1111116
1 Replies

8. Shell Programming and Scripting

Small Help on SED

Hi All, I have come across a command echo "123 abc" | sed 's/*/& &/' output is 123 123 abc then i tried in different ways to get 123 abc abc as output. Can u please explain me the importance of & in the above command. Thank you - Chanakya (7 Replies)
Discussion started by: Chanakya.m
7 Replies

9. Shell Programming and Scripting

scripting guru's pls help me with scripting on AIX

can someone pls help me with the script for a files coming from one system to a particular directory and i want to write a script to move those files to another directory on different system by renaming the files... pls someone help me on this... thanking in anticipation.... (1 Reply)
Discussion started by: thatiprashant
1 Replies

10. UNIX for Dummies Questions & Answers

small unix!

i'm looking to put a very minimal unix on a 386 i just acquired. it needs to be downloadable and i need to install it using 3.5 floppies! thanks for suggestions, -nydel (4 Replies)
Discussion started by: nydel
4 Replies
Login or Register to Ask a Question