The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to apply sub/gsub of awk on a particular field? jaduks Shell Programming and Scripting 1 12-05-2007 05:16 AM
use var in gsub of awk summer_cherry Shell Programming and Scripting 1 10-15-2007 05:01 AM
Gsub and nawk scotty_123 Shell Programming and Scripting 1 05-10-2007 11:10 AM
"next" and "gsub" in awk fedora Shell Programming and Scripting 3 11-15-2006 11:57 PM
Easy question about awk gsub TheCrunge UNIX for Dummies Questions & Answers 1 02-22-2005 05:26 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-15-2007
npolite npolite is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 2
Help with AWK and gsub

Hello,


I have a variable that displays the following results from a JVM....

1602100K->1578435K

I would like to collect the value of 1578435 which is the value after a garbage collection. I've tried the following command but it looks like I can't get the > to work. Any suggestions as to how to get the result?


jvmvalue=` echo $jvmvalue| awk '{gsub(/^[.->]+|[ K),]+$/,"");print}'`


Thanks for your time,

Nick
  #2 (permalink)  
Old 11-15-2007
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
Code:
echo '1602100K->1578435K' | awk -F'>' '{print int($2)}'
  #3 (permalink)  
Old 11-15-2007
npolite npolite is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 2
That did it. Thanks for the help!

Nick
  #4 (permalink)  
Old 11-15-2007
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,952
Code:
echo "1602100K->1578435K" | sed 's/\(.*\)->\(.*\)./\2/'
  #5 (permalink)  
Old 11-15-2007
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,300
Code:
echo "1602100K->1578435K" | sed 's/.*>\(.*\)./\1/'
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:38 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0