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
need to search text and output previous lines grinds Shell Programming and Scripting 8 05-07-2008 10:31 AM
parse through one text file and output many sophiadun UNIX for Dummies Questions & Answers 14 02-20-2008 06:08 AM
execl() + redirecting output to text files JamesGoh High Level Programming 5 02-18-2008 05:17 PM
Searching and extracting text from output sjday Shell Programming and Scripting 3 12-07-2007 04:12 AM
Extract text in 2 columns of output file. Danish Shakil Shell Programming and Scripting 2 10-19-2007 11:03 AM

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 05-01-2008
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,539
Quote:
Originally Posted by raffi View Post
how can i output the number 2641569270623 from a text file called checkpoint.txt that is a one line file (generated by a maths sieving program) that looks like:
pmin=2641569270623,factor_count=8,cpu_secs=1705.793,frac_done=0.002592,elapsed_secs=1710.844

i tried sed -n "/pmin=/,/,factor/ p" checkpoint.txt | sed "$ d" which ouputs nothing and sed -n "/pmin=/,/,factor/ p" checkpoint.txt which output the whole line
until you are more familiar with regular expressions, you can use field based operations
Code:
awk -F"," '{ split($1,a,"="); print a[2] }' file
  #2 (permalink)  
Old 05-01-2008
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,122
Code:
awk -F'[=,]' '{print $2}' file
sed 's#^[^=][^=]*=\([^,][^,]*\).*#\1#' file

Last edited by vgersh99; 05-01-2008 at 12:12 PM..
Closed Thread

Bookmarks

Tags
regex, regular expressions

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 04:54 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