Questions tagged [text-formatting]
Questions about using command-line utilities such as awk, sed, perl, pr, etc. to format text files. For printf format strings, use the [printf] tag. For date format strings, [date]. See also the [text-processing] tag.
608 questions
1vote
2answers
177views
Extracting table of contents from PDFs
I have a reasonably large personal library with books in various formats. I have tried to organize their metadata, including a text field containing the tables of contents. At the moment I am using ...
0votes
3answers
196views
How to edit a string matching a pattern in a specific field on the condition another string is not present on the same line
I need to edit the string "NA" to "Na" only if it is in the 6th field of a file. I can currently achieve this with: awk '{gsub("NA","Na",$6)}1' $filename ...
0votes
4answers
165views
Aligning space separated words in columns
There is a text file, file.txt. In there is: abc 01245 def-1 32154 ghi-3 55432 jkl 44121 mno-4 23147 pqr 897044 .... How to format this to an output like this: abc 01245 def-1 32154 ghi-3 55432 jkl ...
0votes
0answers
33views
is a cell boldface
I'm looking for a function to determine if a cell is formatted bold. I'm using LibreOffice Calc, and for ease of use, I have a range of items to buy and their prices. I want to have a simple method of ...
2votes
1answer
319views
Cannot open an .mbox file with neomutt (although it works with mutt)
Cannot open an .mbox file with mutt I want to open a 10GB .mbox file that I downloaded from my gmail account. When I use the command neomutt -f 10GB_mboxfile.mbox neomutt takes 10-20 seconds to open ...
0votes
0answers
58views
Different format in .mbox and email saved locally with mutt: convert split .mbox file into the same format as mutt?
I am trying to move to mutt for mail client and am trying to have email localy. I have 2 sources of saved email: the first one was obtained from the .mbox file form google: I wrote a script which ...
0votes
1answer
527views
How do I change the date/time format in syslog-ng from `mmm [d]d hh:mm:ss` to `yyyy-mm-dd hh:mm:ss`?
I noticed that the default datetime format for logs in /var/log/messages is mmm [d]d hh:mm:ss, for example: Jan 4 03:46:50 1.2.3.4 ntpclient[6952]: Failed resolving address to hostname pool.ntp.org: ...
0votes
2answers
53views
process a text file to modify a column value based on maximum value from another column
I have a file that i am looking to modify. There are 100's of files having the same issue. the input file is below sample1 100A total 1 1000 sample2 100A total 1 5584 sample3 100A ...
1vote
2answers
165views
Reformat text to exact width [duplicate]
On Ubuntu, how to reformat text to fit width (except final line), adding spaces where necessary? The closest I can get is with fmt --width=64, but this does not add the spaces between words. Input ...
1vote
1answer
52views
How do I format the output of cut to the following format? [duplicate]
last part of the command: | cut -d' ' -f3 output: 4 10 required format: 4,10 I'm guessing echo (and sort?) is to be used in some way, but I can't quite place my finger on it.
2votes
1answer
55views
text formatter that supports bullets
I am looking for a formatter to use with my git commits. par pretty much does what I want, with the (important) limitation that I can't get it to properly format bullet lists, which are pretty common ...
0votes
0answers
147views
Find and replace in CudaText editor
So I have dump from U-boot and I need to replace specific string in CudaText editor. Here is mine text e101b1e0: 30ef27d8 e792f415 9beea618 5c601de4 .'.0..........`\ e101b1f0: aeaf9d25 e1dd63e9 ...
-2votes
1answer
560views
Template for formatting output as a dynamic table in bash
I have a created a simple script which is using the ps aux command to give information for a process entered by a user, and presents the output in a table like format (something like the mysql shell ...
2votes
0answers
49views
Generate upper-case in a udev rule?
I have a use case with cross-platform context which makes me want to generate symlinks under a /dev/disk/by-X directory that have an uppercase version of data returned by blkid. Is there a built-in ...
1vote
1answer
72views
Sed - replace a string with a character of another line
I am trying to write a script to reformat some text. pages: page1: gui-rows: 6 items: '6': material: CAT_SPAWN_EGG buy: 999999999 sell: -1 '7': ...