From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Arnaldo Mandel Newsgroups: gmane.emacs.help Subject: RE: printing columns into a file Date: Wed, 30 Dec 2009 07:39:57 -0200 Message-ID: <19259.8173.972309.480572@kevlar.ime.usp.br> References: <3e9fd39f-2c27-49a5-9f33-51020c58cba2@u7g2000yqm.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1262166073 31596 80.91.229.12 (30 Dec 2009 09:41:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Dec 2009 09:41:13 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 30 10:41:06 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NPv3B-0001Gc-A0 for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Dec 2009 10:41:05 +0100 Original-Received: from localhost ([127.0.0.1]:56382 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NPv3B-0004Ur-Je for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Dec 2009 04:41:05 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NPv2W-0004UJ-Df for help-gnu-emacs@gnu.org; Wed, 30 Dec 2009 04:40:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NPv2R-0004SO-OP for help-gnu-emacs@gnu.org; Wed, 30 Dec 2009 04:40:23 -0500 Original-Received: from [199.232.76.173] (port=59037 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NPv2R-0004SI-Ea for help-gnu-emacs@gnu.org; Wed, 30 Dec 2009 04:40:19 -0500 Original-Received: from hope.ime.usp.br ([143.107.45.8]:49340) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1NPv2R-0006H8-0O for help-gnu-emacs@gnu.org; Wed, 30 Dec 2009 04:40:19 -0500 Original-Received: (qmail 1100 invoked from network); 30 Dec 2009 09:40:00 -0000 Original-Received: from kevlar.ime.usp.br (143.107.45.34) by hope.ime.usp.br with QMQP; 30 Dec 2009 09:40:00 -0000 Original-Newsgroups: gnu.emacs.help In-Reply-To: <3e9fd39f-2c27-49a5-9f33-51020c58cba2@u7g2000yqm.googlegroups.com> X-Mailer: VM 7.19 under Emacs 21.2.2 Full-Name: Arnaldo Mandel X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:70954 Archived-At: Jin wrote (on Dec 27, 2009): > Hi, > > I will really appreciate any help on this! > > I have a file looking like the following > > date month year > > 12 5 1982 > 30 6 1982 > 3 1982 > 28 1877 > 30 2 1888 > > As you can see, my file has blanks in a column, but I like to keep it > that way. > When I tried to use awk to print each column into a separate file > (date.txt, month.txt, and year.txt), > it doesn't retain the blank information on emacs but moves the value > below upward to cover the blank. So, it'd be like There are two solutions: a) You slighly change the file format, introducing a column separator. Tab would be convenient, since you can make it look like a space in emacs. Then you can use that as a field separator for awk or cut. b) If you don't have a field separator, your columns are determined by a range of positions in the line. You can figure them out and give them as parameters to cut -c. -- Arnaldo Mandel Departamento de Ciência da Computação - Computer Science Department Universidade de São Paulo, Bra[sz]il am@ime.usp.br Talvez você seja um Bright http://the-brights.net Maybe you are a Bright.