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].

0
votes
1answer
37 views

To delete the counter line numbers and time-lines in a file

I have a file which is a subtitle (sub.srt or a text file) of a movie. But I wonder if there is a short way to delete all line-numbers and time-lines of the file. For example 85 00:07:39,250 --> ...
0
votes
1answer
22 views

show volume informations in tabular view

I'm trying to save on linux powershell core 6.1 information about the volumes in a variable. Best in the same or similar format as it is possible on windows. But i am unable to achiev this kind of ...
0
votes
0answers
29 views

Why are trailing line breaks stripped when used as an argument (for echo)? [duplicate]

When I run this… echo " fdsfsd dsfsdf " I really get the output of all these lines. However, if I use this output as an argument for echo again…: echo "$(echo " fdsfsd dsfsdf ")" …...
0
votes
0answers
22 views

Convert to Single line output of bc command [duplicate]

echo 'obase=2; 3402823669209384469321375 ' | bc 10110100001001001101110000110101000010010101110011010101100110001011\ 01011010011111 I would like to convert the multiple line output into a single ...
0
votes
2answers
44 views

Concatenate strings with literal tab and new line character

I've a tab/space delimited file as: 31000BL 50014_10011 25467BL 50050_10003 47406BL 50001_10015 40831BL 50114_10006 40830BL 50114_10009 Two columns. I use a ...
1
vote
1answer
24 views

Print table with empty columns for consecutive delimiters

I typically use column to convert input into a table, eg: $ echo 'a\tb\tc\nd\te\tf' | column -t -s $'\t' a b c d e f However it collapses empty columns eg: $ echo 'a\tb\tc\nd\t\tf' | column -t -...
0
votes
1answer
47 views

print number of lines and words in a single line with one spacing in shell scripting [closed]

When I am using wc -lw filename, I am getting output separated into two spaces. But I want only one space separated. How to do this?
0
votes
1answer
38 views

make json from SQL query output

I have this query: select hostname,size from tableinfo output is like this: hostname size ------------------------- ----------- host1 28 host2 ...
0
votes
0answers
33 views

How can I regex match-and-replace _all_ on-screen text?

I need a way to replace an on-screen pattern with another string, regardless of what places that text on the screen. Maybe I can live without user input being replaced, but anything that comes from ...
0
votes
2answers
33 views

Omit one column in ls -hal

How do I omit the group column in the output of ls -hal? I was using ls -hal|cut -f4 --complement -d ' ' and it works find most of the time, but if I run it in / I get scrambled output: drwxr-xr-x ...
4
votes
1answer
131 views

Sort multiple delimited file lexicographically by one column, numerically by another

I wish to sort the TSV file below (called min_ex) by the first column lexicographically and by the second column numerically. A X, N 2.2 A, N 5.7 A, A 5.8 A, N 2.1 A, T 0.2 B G, M 2....
1
vote
3answers
73 views

print a column with the desire format output [closed]

I have a list of the following data in a file: -0.3476890000000000 0.0743938333333333 -1.0990240000000000 0.0743938333333333 -0.2169100000000000 0.0879397500000000 and I am ...
0
votes
1answer
33 views

How to filter text, removing lines where a specific position is empty

# lshw -c network -businfo Bus info Device Class Description ======================================================== pci@0000:03:00.0 enp3s0 network I210 Gigabit ...
2
votes
4answers
129 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 ...
1
vote
2answers
60 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 ...
2
votes
2answers
70 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
52 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
28 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
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
91 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
113 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
108 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
51 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
56 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
2answers
81 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
47 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
18 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
77 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
147 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
3answers
58 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
185 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
167 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
30 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
66 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
28 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
27 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
356 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
50 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
85 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
32 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
158 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
121 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
126 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
318 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
52 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
153 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
77 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 ...