Hot answers tagged

56

iconv -f iso-8859-1 -t utf-8 < file > file.new


30

Use this command: fromdos yourtextfile The other way around: todos yourtextfile These commands are found in the tofrodos package (on most recent distributions), which also provides the two wrappers unix2dos and dos2unix that mimic the old unix tools of the same name.


28

I suggest starting by looking at Markdown, Textile and Grutatxt. But there are many: List of plain-text markup and tools AFT written in Perl. Outputs html, latex, lout, RTF APTconvert no longer available? See Doxia below APT ASCIIDoc Outputs DocBook BBcode (alt) BHL An add-on for the EMACS editor Bobcat Creole Crossmark Deplate Written in Ruby. Outputs ...


24

Depending on which flavor of automatic line wrapping you're using, it'll be one of M-x toggle-truncate-lines if your lines wrap hard at the right-hand edge of the window, or M-x visual-line-mode if your lines "soft wrap" at the whitespace nearest the right-hand edge of the window. (If you're using an Emacs version older than 24.4, it may also be M-x ...


21

This can now be done (at least in v5.9.8) via the combination of some commands in the Edit menu. Edit > Line Operations > Split Lines will insert a hard wrap at the width of the window. The hotkey for this is Ctrl-I. Edit > Line Operations > Join Line will join lines and has a hotkey of Ctrl-J. So for a paragraph on one line, if you want to ...


19

From this link: There are two types of formatting: Character (which can apply to one or more characters) and Paragraph (which always applies to one or more paragraphs). You can find these settings in the Options bar (when the Text tool is selected in the Tool palette) or in the Character and Paragraph palettes. Leading (“ledding”) ...


19

To and expressions with grep you need two invocations: grep -Ei "search term" | grep -Eiv "exclude term" If the terms you are searching for are not regular expressions use fixed string matching (-F) which is faster: grep -F "search term" | grep -Fv "exclude term"


18

Use dos2unix. dos2unix - DOS/MAC to UNIX text file format converter dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...] Options: [-hkqV] [--help] [--keepdate] [--quiet] [--version]


18

To convert sequences of more than one space to a tab, but leave individual spaces alone: sed 's/ \+ /\t/g' inputfile > outputfile To do this for a number of files: for inputfile in * do sed 's/ \+ /\t/g' "$inputfile" > tmpfile && mv tmpfile "$inputfile" done or for inputfile in * do sed -i .bak 's/ \+ /\t/g' "$inputfile" done ...


16

It's sort of weird. If you just want to wrap a paragraph at 72 characters you can just go to TextFX>TextFX Edit>ReWrap Text to (Clipboard or 72) width. Which will re-wrap your selected text to 72 characters. If you want a 61 or 87 character wrap however, you need to copy the text "61" into your clipboard and then do the same thing (TextFX>TextFX ...


14

Here's what I would do: Get-Content .\in.txt | Where-Object {$_ -notmatch 'not'} | Set-Content out.txt Snark's line does the same, but it starts with loading all of the file into an array, which may be problematic with big files memory-wise.


14

I have found that to set the default to "Paragraph" or "Body Text", you need to navigate from the main menu: Tools->Options->"Composition" region -> "General" tab In the HTML section, find the option for "When using paragraph format, the enter key creates a new paragraph" Select that option if you want "Paragraph" as the default. Deselect that option if ...


13

Note that this has nothing to do with bash (once you've launched the command, bash just waits for it to finish) and everything to do with the terminal. Most terminal emulators wrap at the right margin by default. But this can be turned off by using the appropriate control sequence, if the terminal emulator supports it; then long lines are simply truncated: ...


13

I was wondering if some text files store their encoding method along their text content for later decoding? Mark Szymanski's answer is correct - there is no explicit encoding information in a plain text file - that's the definition of "plain text file", the "plain" refers to the fact that there is no meta-data in the file. However, some applications ...


13

Pull out your command line and let's go: copy /a *.txt concat.txt This will concatenate all txt files in the same directory into one file named "concat.txt". /A indicates an ASCII text file


12

I prefer perl: perl -lne 's/\r//g; print' winfile.txt > unixfile.txt But that's well-suited to my uses, and it's very easy for me to remember. Not all systems have a dos2unix command, but most that I work on have a perl interpreter. Another is recode, a powerful replacement for dos2unix and iconv; it's available in the "recode" package in Debian ...


12

I found this Format Text as a Table online utility which is extremely useful. Apparently it was created specifically for SE by senseful! Of course, there are (both online and offline) ASCII art editors as well that might help.


11

Maybe you should give this addon a try. I've never used it but it looks like it might work for you.


11

I've used Agent Ransack for years and highly recommend it.


11

pdftotext that comes with poppler will try to extract any text found in the PDF.


11

"Cell padding" as such does not exist in Word, but you can try these: (I have Word 2007 2010 for Windows right now, but the commands should be similar) Open Borders and Shading dialog (Ribbon -> Home Tab, Paragraph sub tab, click on the arrow near the "Borders" icon) Click on "Borders and Shading" Click on "Options..." Adjust the values in "From text" ...


11

Use the script utility to capture the terminal output to a file (ansi color control characters included) and then convert it to html with ansi2html script. Eg: inigo:tmp> script Script started, file is typescript inigo:tmp> ls # # lots of colour output # inigo:tmp> exit exit Script done, file is typescript inigo:tmp> cat typescript | ansi2html....


9

You might consider getting an old Toshiba Libretto laptop and set it up to run as a 3270 or a VT52/VT100 terminal with an emulator program. You can either run Putty on Windows, run a terminal over a serial cable or you could even load up a version of linux and ssh from one to the other across the network. The bonus is the old libretto models are all cheap ...


9

There is an ASCII Art Generator which may help you out.


9

Looks like SourceGear DiffMerge will give you this, with its ruleset support for XML (and lots of other languages). I'm not sure if it will fix all your problems, because the example is of course a simplification of the actual program. I tried slightly more complex changes, and those seem to work fine too. See the sample below for the diff you described


9

If you'd like to be able to do horizontal scrolling instead of truncating the lines, use less -S.


9

Edit > Preferences > View Tab > Text Wrapping options right there, front and center. Not "well hidden" by any means.


9

The .txt filename extension serves a purpose on Windows, where the filename extension helps determine which programs are associated with that file - which one is used to open, edit or perform other types of action on it. On Unix/GNU-Linux, the system works out the type of a file without referring to the filename extension. It does have some uses in ...



Only top voted, non community-wiki answers of a minimum length are eligible