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
2answers
27 views

How to get Hexdump output onto 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
49 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
175 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
152 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:...
0
votes
1answer
15 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
40 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
0answers
15 views

Sequentially print data output as a formatted table in Python [migrated]

I have written a Python script to execute data like My script : import os import os.path import re import smtplib from email.mime.text import MIMEText infile = r"D:\i2Build\i2SchedulerReport.txt" ...
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
260 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
106 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
23 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
2answers
223 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
22 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
78 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
28 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
72 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
31 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
109 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
97 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
272 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
49 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
65 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
30 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
51 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
89 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
91 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
43 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
45 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
43 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
285 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 ...
1
vote
1answer
69 views

Two consecutive OPs after pipe or two jq OPs in one run?

I have to extract data from a slightly mis-formatted JSON string, hence I first pass it through sed & awk. What I have is a command like: `sed 's/},/},\n/g' test.json |awk '/"characater"/ { gsub("...
1
vote
1answer
38 views

How to create a list of email addresses from ldapsearch result for further processing?

For an automated mailing and to notify user, respective members of a specific group, I am looking for commands or a single command line which provides a list of email addresses and which can be used ...
1
vote
2answers
47 views

Remove suffix from data in col 4 of csv file only (bash)

I have a csv file that col 4 of contains a suffux of "_1" that I need to remove without disturbing the other columns in the csv that may or may not contain a suffix of "_1". CSV FILE OUTPUT: DOM,...
3
votes
4answers
192 views

Use sed to encapsulate the first word of each paragraph with <i> </i>?

So obviously I am trying italicize a the first word of each paragraph in a huge document. I think its relatively easy to add the prefix but how to I delineate just the first word for the postfix ...
0
votes
1answer
181 views

Split one column into multiple columns with formatted output

I want to print the output of usernames from /etc/passwd into multiple columns. The output from my server is [root@master vdabas]# cat -n /etc/passwd | cut -f1 -d":" 1 root 2 bin 3 daemon 4 ...
7
votes
5answers
374 views

sed only removing \n provided by sed '=' command

I created a file using: printf 'this is \n not is \n is is \n this biz' > file2 when I try to remove all \n(newline) it only remove sed's own inserted number's newline sed '=' file2 | sed 'N; s/...
0
votes
5answers
68 views

parse linux paths as columns in a .csv file bash

I have a .csv data file which I have manipulated to look like this: -------------PATH AND FILE NAME--------,USER--,DATE-----,TIME---,STATUS /Proj/abc/app/app_pit/conf/HUB_TEST.apx,uJones,4/24/...
4
votes
1answer
67 views

How to display columns in tab separated files nicely?

I have some Tab separated files that consist of a header that are quite unreadable because of the different length of table entries. Essentially, it looks somewhat like c1 c2 c3 c4 A 0 ...
0
votes
2answers
45 views

Shell Script to fetch linux processes and show the process count for individual user as “.” [closed]

Eg. Processes being run by various users are as below. root 5 xuser 3 yuser 1 Then the script should give the output as: root ..... xuser ... yuser .
1
vote
1answer
794 views

Tool to auto-format shell script

I got some code above which was into a pdf document, wherever I try to post it indentation is terrible, I would like to get it to a proper formatting for debbuging. Here is my code: #!/bin/bash #...
0
votes
1answer
37 views

convert ncurses binary dump into text

I have a ncurses dump (with for example screen recorder from GNU screen) and I would like to convert it into text (there are some conversations in it, some lists and other things, all text, but ...
3
votes
2answers
226 views

Indent paragraph of text printed by a bash script

I have a bash script that echoes paragraphs of text. I want them to be indented. Example: echo "Something" echo -e "\tfoo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo ...
1
vote
1answer
21 views

Sorting a list by column

I have a list similar to the following: 192.168.2.1 sometext.com 192.168.2.1 192.168.2.3 192.156.1.6 192.156.1.6 moretext.com 192.123.1.1 192.564.7.3 192.564.7.3 hello.com Output I need: ...
3
votes
4answers
130 views

Convert separator character while escaping separator in fields

I have a text file with fields delimited by |. I want to convert it to , like a typical CSV. I have tried to use this: sed 's/|/,/g' test.txt > test.csv but some of the fields already have ...
1
vote
3answers
85 views

How can I pretty format a JSON file, with all the correct indents and everything?

I have a JSON file on CentOS where all text is on the same line. How can I pretty format it with all the correct indents and everything?
0
votes
2answers
975 views

Display grep output in table columns

I need some help to display grep output in table columns. I have a script that grab info from whois to display the creation, expiry date and ns server of specific domain names. #!/bin/sh cat domain-...
1
vote
3answers
82 views

How to left pad a column in Bash

I have a bash script that prints the following results: 120,900 1160,001 80,730 600,165 6,310 1111,203 I would like to left pad that so the result will be: 120,900 1160,001 80,730 600,165 6,...
0
votes
3answers
52 views

Aligning the third word with 20 spaces from the beginning of the second word [duplicate]

We have the following file: cat info.txt linux03.sys98.com net16777728 Speed: 1000Mb/s linux03.sys98.com net16777728 Speed: 1000Mb/s linux01.sys98.com net3f0 Speed: 1000Mb/s ...
1
vote
2answers
220 views

unix command formatting flattening nested json objects data

example input data format json data: { div1: { name: "some name", age: number, address_1: "some address", items: { item_x1: "some data", .. .. ...