Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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 [tag:printf]. For date format strings, [tag:date]. See also [tag:text-processing].

2
votes
2answers
113 views

How to break line after matching case but needs to go back a couple of characters

I have the following sample: 1. TNT 00:00 2. Swing From The Gutters 7:34 3. Ten-Day Interval 13:29 4. I Set My Face To The Hillside 18:16 5. The Equator 24:26 6. A Simple Way To Go Faster Than Light ...
0
votes
0answers
30 views

How to get the ID and Receiver mail address details from postfix [closed]

I have the following message output when I use postcat -q CEEFE416EAB5: *** ENVELOPE RECORDS deferred/C/CEEFE416EAB5 *** message_size: 375 253 1 0 ...
1
vote
2answers
55 views

How do I align columns at common elements but give differing elements their own rows?

I am using paste to merge three text files (which do not require sorting) into a single document with three columns. paste a.txt b.txt c.txt I'd like elements that the columns have in common to ...
-1
votes
0answers
18 views

Printing a disk to the terminal [migrated]

I am writing a program to play connect-4. The output to the terminal is shown below, the 0s are color coded on the terminal doesn't seem to be possible on stack exchange. Anyway, what I want to try ...
0
votes
0answers
14 views

yum + get the list with the right order

I am use yum list from some reason the last line ( the second field ) - "7-2.el7" jump to the next line yum list Loaded plugins: langpacks Installed Packages GConf2.x86_64 ...
1
vote
2answers
50 views

How can I get less to display \n as a newline?

I have some files containing \n newlines that I am viewing with less. I would like to be able to have less display those newlines as actual newlines. For example an array: Array\n(\n [Color] =&...
0
votes
1answer
20 views

AWK print specific fields without specific word

Input: a-0;Password-1010;c-ss;d-fk;h-14;i-jawad;j-dd;Email-1@1.com; a-7990:15:71;b-aa;c-1;Password-2020;h-iOS;Email-2@2.com; Output: 1@1.com,1010 2@2.com,2020 my input file is the same as my ...
0
votes
0answers
25 views

Display a bash script and all its functions in a visual way

Is there a tool (general or bash / shell specific) that can display a code into in clean visual representation of the functions. Like a visual algorithm with bubbles with the name of the functions ...
0
votes
0answers
17 views

Selectively retrieve portions of a large file if a condition is met

I have a large file with many sections like this: Bayes Empirical Bayes (BEB) analysis (Yang, Wong & Nielsen 2005. Mol. Biol. Evol. 22:1107-1118) Positively selected sites (*: P>95%; **: ...
0
votes
0answers
20 views

Is there a good way to remove text formatting by piping through a program? [duplicate]

I have a program (expressvpn) which is outputting to terminal with some sort of color formatted text. If I execute expressvpn status i get back Connected to USA - Seattle - If your VPN ...
0
votes
2answers
37 views

How to avoid data trimming while formatting file in unix

I have a file in below format A |b -c | c | d -c | | | And I need to format the above file like below A|b -c|c|d -c||| Please note, I don't want to remove the space ...
-1
votes
1answer
42 views

Why text in the gnome-terminal has characters slightly overlapping themselves

This is the screen shot of my gnome-terminal: You can see that all the text is messed up. The username is heman and the host name is arch linux but the characters are not even readable because they ...
0
votes
2answers
82 views

Formatting output with printf piped in with xargs

I want to search my code base for ocurrences of a string, and then get the formatted output as filename, line number, and code lide. I got it as I wanted on the first line of the output, but the ...
0
votes
1answer
57 views

Embed ascii diagram in groff?

I have groff file to generate a pdf in the format: .TL Article title .AU Author name .AI Publication title .SH .LP First paragraph .PP More paragraphs I'm then running groff -ms a.ms -T pdf > a....
0
votes
1answer
46 views

Formatting ps output based on given parent/child processes

Given a list of process names, I want those parent/child processes to not appear in the output of a ps --forest call. This will reduce the processes that I need to look at when I'm tracking things.
1
vote
1answer
37 views

How to align a string variable in Bash

I'm trying to align a string variable in Bash. This is the desired behaviour. if str1="123" , then str2=" 123" if str1="1234" , then str2=" 1234" if str1="12345", then str2=" 12345" etc. I'...
4
votes
0answers
46 views

How to get traditional email clients to send email which appears normal in Gmail?

A considerate friend informed me recently that emails I send (with Neomutt; could be Mutt or Gnus or Pine) look funny on his device: Apparently Google doesn't invest much effort in properly ...
-1
votes
2answers
45 views

reformatting table with various copy paste

I have something like this in a file: 00550 Peptidoglycan biosynthesis (2) K01000 K02563 00511 Other glycan degradation (6) K01190 K01191 K01192 K01201 K01227 K12309 I need something like this : ...
0
votes
1answer
14 views

how to reformat Kegg mapper output in linux?

I need to reformat the kegg reconstruct pathway output, I have something like this in file1: 00550 Peptidoglycan biosynthesis (2) K01000 K02563 00511 Other glycan degradation (8) K01190 K01191 ...
1
vote
3answers
69 views

Bash output two results next to each other

I have an out from xmllint and egrep that I would like to print two fields next to each other. e.g. (xmlinput) xmllint --format | egrep reference\|sourcefile <reference>ItemX</reference> &...
0
votes
2answers
55 views

How to get Hexdump output in same format as hexedit?

I'm trying to get the output of my hexdump command to look similar to hexedit default. I've been playing with the format strings using -e, but since there are not very good documentation, that ...
0
votes
2answers
51 views

Organizing data by a header

I have two csv files. File 1 contains header. File 2 contains data file 1 format : file1.csv id,abc,xyz,aaa,bbb,ccc file 2 format : file2.csv id,source,value 1,abc,100 1,xyz,...
-1
votes
2answers
182 views

Add four lines between sentences [duplicate]

Is there an easy way to add four empty lines between each sentence. For example, this paragraph: This combination of vitamins and selected minerals is used to prevent or treat vitamin deficiency ...
2
votes
2answers
159 views

Turning data collected vertically to a table

I have data was collected and saved in file "data.txt", in the following format: <$ MG_nr> </200>company-type:Engine1 </210>company-name:STR </220>address:XX </230>nr:...
1
vote
1answer
23 views

Turning off word-wrap with less during paging?

I can get the effect that I want from running less -S but it seems fishy to me that there is no way to render the input without word-wrap after the file is opened. Is there anyway to less /tmp/...
0
votes
3answers
65 views

Attach session numbers to its relevant IDs

I have long records were collected as an output of a code, Part1=STS768976N-4BT345432-X00001-87675789AAAS Session=9 Part2=STS876578N-2BT234522-X00002-23456789UJHG Session=10 Part3=ST9876887N-...
0
votes
2answers
27 views

reorganize text in sentences

have text file like this one: group0 Level 1 name Matty1 name nickname member4 name Matty2 name nickname member14 group1 ...
3
votes
2answers
366 views

order words beside each other

how can I re order words beside each other in two columns? for example: Mark 150 John 221 James 134 Sara 9873 I want it to be: Mark 150 John 221 James 134 Sara 9873
0
votes
2answers
207 views

line up security identifier numbers horizontally

I have these security identifiers IDs (SIDs) SID_1 S-1-2-12-347289564783285475 SID_2 S-1-2-12-312478290434839212 S-1-2-12-312748912347723432 S-1-2-12-123475184123489632 SID_3 SID_4 S-1-2-12-...
0
votes
3answers
25 views

How can I align columns and reverse the last field in a messed-up biology table

I have a table that was generated and the numbers got messed up: 0.967662 0.850492 0.935517 325969 1.071937 0.976805 1.086638 526410.1 0.972091 0.871967 0.950352 306079 1.048607 0....
4
votes
3answers
351 views

How to reformat text in a file to another direction?

I have table in the current format: Lead:Arrow1:Arrow2:Arrow3 Follow:Arrow4:Arrow5:Arrow6:Arrow7:Arrow8:Arrow9 I want to turn this to the Lead Arrow1 Arrow2 Arrow3 Follow Arrow4 Arrow5 Arrow6 ...
0
votes
1answer
24 views

Display single row with headers one column per line in bash

I want to display a single row from a large csv file with headers next to it using bash. The file: head1, head2, head3.... data1.1, data1.2, data1.3 data2.1, data2.2, data2.3 ... I want to see row ...
1
vote
1answer
84 views

Adjust columns in a table

I have this table which is messed up DB Size_in_MB foobar 11011.2 barfoo 4582.9 donkey 4220.8 shoryuken 555.9 hadouken 220.0 kong 214.8 super_mario_bros_p 211.1 there are unnecessary ...
1
vote
2answers
31 views

remove flaws in text after conversion using PDF OCR technique

I convert PDF file using OCR PDF reader. originally the text was an images in the PDF file and PDF Foxit convert it to text using OCR now the problem after conversion is the text is not aligned ...
1
vote
4answers
105 views

command that will take a file and separate each word so its on its own line

I have a file which has around 17523 words in it and I need to separate each word so it is on its own line (a word is defined to be a contiguous sequence of letters, so 1 letter words don't count) ...
0
votes
0answers
32 views

Paste into a nano editor [duplicate]

I try to copy a paragraph from Word file into a nano editor. When, I open the file nano file.txt, I remark that the text is set into one long line. Is there any option to automatically set the ...
1
vote
1answer
113 views

display file meta data in formatted columns

I need to display file meta data from the current directory in the format below. The first column should be left-aligned, second centered and third right aligned to the right end of the terminal ...
3
votes
1answer
103 views

Convert WPA_passphrase output to /etc/network/interface

This is primarily a formatting problem which I haven't been able to solve well. I want to create a bash function or script which converts output from wpa-passphrase to a format that can be used by /...
3
votes
4answers
293 views

Extract addresses separated by semicolon and print each address in a line

I have a file with the following input. The numbers separated by dots represents addresses. Any number in address can be one or more digits as follows: [112.112.112.112;3.3.3.3;44.44.44.44] [6.6.6.6;...
1
vote
4answers
51 views

How to process a column's multiple strings

I have a comma separated file that looks similar to his format: aa.com,1.21.3.4,string1 string2 K=12 K2=23 K3=45 K4=56 bb.com,5.6.7.8,string1 string2 K=66 K2=77 K3=88 K4=99 I want to take ...
0
votes
2answers
109 views

Find lowercase character in uppercase word

I'm trying to change formatting for few specific characters that appear in lowercase, while the whole word is formatted uppercase. file looks like: „АРХЕОЛОшКИ ПРЕГЛЕД (АРХЕОЛОшКИ ПРЕГЛЕД)“ - ...
1
vote
1answer
40 views

iperf3 results should look nice in a logfile

I have this result: Wed Aug 15 19:35:11 CEST 2018 Connecting to host x.x.x.x, port 5201 [ 4] local x.x.x.x port 48944 connected to x.x.x.x port 5201 [ ID] Interval Transfer Bandwidth ...
1
vote
2answers
46 views

Reconsider spacing of columns

I have a file with the following format 1 1 1 0.02484183 57.2400000 24.6000000 2 1 2 -0.16091000 56.5200000 24.5600000 3 1 1 0.02484183 55.5700000 24....
1
vote
6answers
53 views

Regex to format files output

I have file which has the following contents: foo-6-25.example.com: 1 Var. Speed System Board Normal Yes Normal ( 49) -- foo-5-4.example.com: 1 Var. ...
4
votes
2answers
90 views

Preformat output CSV

I have a script bash that converts this file "origin.txt" cxx-yyy-zzz-999-111 2018-01-1T00:10:54.412Z 2018-01-5T00:01:19.447Z 1111-6b54-eeee-rrrr-tttt 2018-01-1T00:41:38.867Z 2018-01-5T01:14:55.744Z ...
1
vote
2answers
98 views

How to format a file's last 3 columns starting at the 30th tab or 88th space

Ubuntu 16.04 GNU bash, version 4.4.0 I would like to format this text file filed with zip codes containing 1,264,524 lines. #!/bin/bash wget http://download.geonames.org/export/zip/allCountries....
0
votes
3answers
44 views

removing variable string on many files

I have many files that contain similar strings as: >33100_Pseudomonas_etcetera1 texttexttext >33632_Pseudomonas_etcetera2 texttexttext >36406_Pseudomonas_etcetera3 texttexttext and I need ...
3
votes
0answers
51 views

What's the “Unix Way” to propery format tabular output?

I'm writing a set of "Unix Way" tools, where you have a set of small tools that you can pipe into each other (and other tools). The question (more details as to why I care below) is this: Is there a ...
3
votes
0answers
46 views

Git - prune every whitespace-separated word originally introduced by specific author in project's history

We have a project under git revision control with only a single branch. We need to remove every new whitespace-separated word that was introduced for the first ever time in a given file by a specific ...
5
votes
4answers
364 views

Get numbers matching a pattern from the output of ls?

I have a folder, and when I execute ls in it, it outputs t-1-myFirstTest.c myFile.c t-42-my_second_test.c t-3-test1234.c . . . mySecondFile.c t-21-tset241.c I want to delete everything of this ...