LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-25-2007, 12:25 AM   #1
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Rep: Reputation: 30
how to truncate


hi all
Quote:
mozilla -V
the output is
Quote:
Mozilla 1.7.13, Copyright (c) 2003-2004 mozilla.org, build 2006050116
how to truncate this , using bash script.
i wanna out put like
Quote:
mozilla-1.7.13
i dont know the above command(mozilla -V) is usefull or not..
this folder is place in my machine path
/usr/lib
i have to get this path using bashscript.
please help me
thank you in advance
 
Old 07-25-2007, 12:40 AM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
There are all sorts of ways to do this. Try this at the command line:

Code:
man sed
 
Old 07-25-2007, 12:59 AM   #3
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by wjevans_7d1@yahoo.co
There are all sorts of ways to do this. Try this at the command line:

Code:
man sed
i tried this
mozilla -V | cut -f2 -d' '
but it is not helpfull.
simply my question is all about..
dynamic path of mozilla with version using script..
with this script, i have to know path of the mozilla with version..


can you please help me

thank you in advance
 
Old 07-25-2007, 08:40 AM   #4
cconstantine
Member
 
Registered: Dec 2005
Distribution: RedHat, Ubuntu
Posts: 101

Rep: Reputation: 15
Code:
mozilla -V | awk -F, '{print $1}'
??
-c
 
Old 07-25-2007, 09:18 AM   #5
Hobbletoe
Member
 
Registered: Sep 2004
Location: Dayton, Oh
Distribution: Linux Mint 17
Posts: 150

Rep: Reputation: 18
Code:
mozilla -v | cut -d',' -f1 | tr A-Z a-z | tr ' ' '-'
Should get you what you want. The cut pulls everything befor the comma after the version number, the first tr would change the M in Mozilla to an m, and the second one would change the space between Mozilla and the version to a dash.

However, I see on my system (Mepis 6.0), that 'mozilla -v' returns 'Mozilla Firefox 1.5.0.4, Copyright (c) 1998 - 2006 mozilla.org', so your output might not be the same of different systems. You could ...

Code:
echo mozilla-$(mozilla -v | cut -d',' -f1 | tr -d a-zA-Z' ')
Which would echo mozilla, then strip out all of the characters and spaces, leaving just the version number.
 
Old 07-25-2007, 11:56 PM   #6
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Original Poster
Rep: Reputation: 30
linux script

its great.

i got a strange problem..
i have to write make file script for this am giving here my ideas in step wise.
it has to be run in make file...(gtk c, makefile).
1.mozilla -V | sed -e 's/\([^,]*\),.*/\L\1/' -e 's/ /-/'
this is to know current mozilla version.
and the output has to store in a variable or string
(for example "i")after this immediately...run the second step.

2.whereis i
this is to know where the current mozilla version is.. in our machine...( here it will tell EX: /usr/lib/mozilla-1.7.13)
it has to be stored in a variable or string.. let us say "j"

3.-Lj -lxpcom
instead of giving like this
"-L/usr/lib/mozilla-1.7.13 -lxpcom"
am giving "-Lj -lxpcom" dynamically..
here am including the libxpcom.so to the exe. in the make file. j=path of the current mozilla directiory(/usr/lib/mozilla-1.7.13)
so that each and every time when the exe running.. it will check the current version and adds library path..

this all how to write in make file(using linux script)
please help me

thank you in advance
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i truncate this munna_dude Linux - Networking 1 06-15-2007 11:42 PM
how can i truncate this munna_dude Programming 24 04-12-2007 03:44 AM
Truncate A File Dovetails Linux - Newbie 2 10-22-2005 06:58 PM
truncate lines with c alaios Programming 17 08-25-2005 08:51 AM
how to use truncate sureshbabu Linux - Newbie 1 10-29-2003 04:22 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration