From: Arnaldo Mandel <am@ime.usp.br>
To: help-gnu-emacs@gnu.org
Subject: RE: printing columns into a file
Date: Wed, 30 Dec 2009 07:39:57 -0200 [thread overview]
Message-ID: <19259.8173.972309.480572@kevlar.ime.usp.br> (raw)
In-Reply-To: <3e9fd39f-2c27-49a5-9f33-51020c58cba2@u7g2000yqm.googlegroups.com>
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.
prev parent reply other threads:[~2009-12-30 9:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-28 2:45 printing columns into a file Jin
2009-12-28 11:49 ` Pascal J. Bourguignon
2009-12-30 9:39 ` Arnaldo Mandel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19259.8173.972309.480572@kevlar.ime.usp.br \
--to=am@ime.usp.br \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.