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.
615 questions
1
vote
0
answers
47
views
Wrap long lines using GNU sed
The following expression is reasonably effective at wrapping long lines of text (for the purpose of dumping to my 128 characters wide terminal window and reading):
s~(.{104,124}) ~\1\n~g
This ...
1
vote
2
answers
58
views
Can I get the "detox" command to not change multiple hyphens to a single hyphen?
The detox command replaces multiple consecutive hyphens with single hyphens.
For example, temp----tmp___tump.tmp becomes temp-tmp_tump.tmp.
Can I modify its behaviour so that it keeps multiple ...
2
votes
1
answer
192
views
`printf` and `time` formatting issues in a `zsh` shell script
I have the following (excerpt from a) zsh shell script (the FOLDER environment variable is exported earlier in the code):
# Create temporary directory
export TMPDIR=$(mktemp -d)
# Set TIMEFMT to ...
1
vote
2
answers
78
views
How to pretty print one column of piped input?
bash 4.4.20 and jq-1.6 on RHEL8
I get this nice output from jq and column. Hard to read, though.
pgbackrest info --output=json \
| jq -r '.[] | .backup[] | "\(.type) \(.label) \(.info.delta)...
0
votes
1
answer
52
views
Storing the iterations of the Receiver (or node) number and RSSI value into a file
I'm quite new to Linux. Recently, I've been able to create a bash script that allows me to obtain the RSSI of the receivers (or node) with a running iteration. How can I store these results in an text ...
-4
votes
1
answer
90
views
file format help [closed]
input file
Env Status (PRE)
tomcat1
|-- Status : Running | Host : VVV | pid/s : 7427
|-- Status : Running | Host : VVV | pid/s : 489
|-- Status : Running |...
0
votes
2
answers
95
views
In a text file, finding and deleting lines including (e.g.) "#', or a word? [duplicate]
I am using Ubuntu Linux and Mageia Linux...
I wish to do the following:
in a text file (sample.txt), find and delete every line comprising the symbol '#' (or '?') or a specific word (e.g. 'mobile')
...
1
vote
2
answers
345
views
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 ...
0
votes
3
answers
298
views
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
...
0
votes
4
answers
226
views
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 ...
0
votes
0
answers
56
views
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 ...
2
votes
1
answer
414
views
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 ...
0
votes
0
answers
79
views
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 ...
0
votes
1
answer
819
views
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: ...
0
votes
2
answers
68
views
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 ...