From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Politz Newsgroups: gmane.emacs.help Subject: Re: Easy for Some Date: Mon, 04 Jan 2010 21:40:33 +0100 Message-ID: <87fx6l8uym.fsf@fh-trier.de> References: <27011067.post@talk.nabble.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1262667038 25269 80.91.229.12 (5 Jan 2010 04:50:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Jan 2010 04:50:38 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 05 05:50:30 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from terminus-est.gnu.org ([66.92.78.210] helo=lists.gnu.org) by lo.gmane.org with esmtp (Exim 4.50) id 1NS1ND-0004FL-EQ for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Jan 2010 05:50:30 +0100 Original-Received: from localhost ([127.0.0.1]:36671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NS1N7-0001fE-Dw for geh-help-gnu-emacs@m.gmane.org; Mon, 04 Jan 2010 23:50:21 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NS12K-0006zC-Jf for help-gnu-emacs@gnu.org; Mon, 04 Jan 2010 23:28:52 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NS12F-0006s2-32 for help-gnu-emacs@gnu.org; Mon, 04 Jan 2010 23:28:51 -0500 Original-Received: from [199.232.76.173] (port=52769 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NS0KL-0006wH-St for help-gnu-emacs@gnu.org; Mon, 04 Jan 2010 22:43:26 -0500 Original-Received: from mx20.gnu.org ([199.232.41.8]:5750) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NRzwC-0002f4-Ej for help-gnu-emacs@gnu.org; Mon, 04 Jan 2010 22:18:28 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NRtnw-00013b-Kc for help-gnu-emacs@gnu.org; Mon, 04 Jan 2010 15:45:32 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1NRtkP-0002UN-GN for help-gnu-emacs@gnu.org; Mon, 04 Jan 2010 21:41:53 +0100 Original-Received: from dslb-084-059-206-234.pools.arcor-ip.net ([84.59.206.234]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 04 Jan 2010 21:41:53 +0100 Original-Received: from politza by dslb-084-059-206-234.pools.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 04 Jan 2010 21:41:53 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 64 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dslb-084-059-206-234.pools.arcor-ip.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:2nH+gH59ACk8Wf3pSWwwFmr4Ri8= X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:71052 Archived-At: marioepsley writes: > I'm not coder but i needed to extract some information from a text file and > some one pointed me in this direction. > > I have a file like this, could have up to a 1000 keyframes.: > > > > Effects Sound Keys #1 Output 1 #22 > Frame > 0 0.17489 > 1 0.261281 > 2 0.361762 > 3 0.400085 > 4 0.411538 > 5 0.434799 > 6 0.41712 > 7 0.422151 > 8 0.43181 > 9 0.411811 > > Just to clarify the spacings: ( 0 0.17489 ) > Just to clarify the spacings: (tab0tab 0.17489 tab) > > and i want to be left with just the raw values like this: > > > 0.17489 > 0.261281 > 0.361762 > 0.400085 > 0.411538 > 0.434799 > 0.41712 > 0.422151 > 0.43181 > 0.411811 > > > I am a complete newbie, i downloaded aquamacs emacs yesterday, tried to use > replace string as a guess...?? no joy. Dont have anyone to ask, any help is > greatly appreciated. There are many ways to solve this (See the other replies.). Most of them use regular expressions in one way or another. First move to the beginning of your file and get rid of the lines you don't want. (All based on your example data. 'RET' means 'return/enter key', 'M-<' means press Alt/Meta + '<', 'M-x' likewise.) M-< M-x keep-lines RET ^\s-*[0-9]+\s-+[0-9]+\(\.[0-9]+\)?\s-*$ RET Back to the beginning. M-< Now, on every line, replace everything with the decimal number. M-x replace-regexp RET ^\s-*[0-9]+\s-+\([0-9]+\(\.[0-9]+\)?\)\s-*$ RET \1 RET I hope this works. -ap