Questions tagged [columns]

Use this tag when describing a specific portion of a particular group of entries in a table or a matrix or any other structured data set which is vertically aligned.

Use this tag when describing a specific portion of a particular group of entries in a table or a matrix or any other structured data set which is vertically aligned.

338 questions
176
votes
10 answers

How do I use cut to separate by multiple whitespace?

I have this input, which is displayed in columns. I would like to get the second last column with the numbers of this sample: [ 3] 1.0- 2.0 sec 1.00 MBytes 8.39 Mbits/sec [ 3] 2.0- 3.0 sec 768 KBytes 6.29 Mbits/sec [ 3] 3.0- 4.0 sec 512…
rubo77
  • 27,777
  • 43
  • 130
  • 199
97
votes
7 answers

Is there a simple command for outputting tab-delimited columns?

E.g. I have a file (produced with echo -e "var1\tvar2\t\var3\tvar4" > foo) that are output as: $ cat foo case elems meshing nlsys uniform 2350 0.076662 2.78 non-conformal 348 0.013332 0.55 scale 318 0.013333 …
Sebastian
  • 8,677
  • 4
  • 39
  • 49
95
votes
4 answers

How can I use column to delimit on tabs and not spaces?

I'd like to use the Unix column command to format some text. I have fields delimited by tabs, but within each field there are also spaces. column delimits on white space (tabs and spaces). How can I make column only use tabs as the delimiter? I was…
turtle
  • 2,607
  • 5
  • 19
  • 16
48
votes
4 answers

Bash shell script output alignment

My script: date echo -e "${YELLOW}Network check${NC}\n\n" while read hostname do ping -c 1 "$hostname" > /dev/null 2>&1 && echo -e "Network $hostname : ${GREEN}Online${NC}" || echo -e "${GRAY}Network $hostname${NC} : ${RED}Offline${NC}" done <…
pijaaa
  • 491
  • 1
  • 4
  • 4
39
votes
5 answers

print output to 3 separate columns

MYPATH=/var/www/html/error_logs/ TOTALFILE=$(ls $MYPATH* | wc -l) FILETIME=$(stat --format=%y $MYPATH* | head -5 | cut -d'.' -f1) FILE=$(ls -1tcr $MYPATH* | head -5 | rev | cut -d/ -f1 | rev) TOPLINE=$(head -1 $MYPATH* | grep -Po '".*?"' | head…
ADM
  • 501
  • 1
  • 4
  • 7
38
votes
4 answers

Split long output into two columns

Is there a simple utility or script to columnate the output from one of my scripts? I have data in some form: A aldkhasdfljhaf B klajsdfhalsdfh C salkjsdjkladdag D lseuiorlhisnflkc E sdjklfhnslkdfhn F kjhnakjshddnaskjdh but if this becomes two…
Hemmer
  • 483
  • 1
  • 4
  • 7
30
votes
7 answers

cut column 2 from text file

My text file has no delimiter to specify separator just spaces, how do I cut out column 2 to output file, 39 207 City and County of San Francisc REJECTED MAT = 0 78 412 Cases and materials on corporat REJECTED MAT =…
riley
  • 331
  • 1
  • 4
  • 4
29
votes
1 answer

Sort only on the second column

I'm trying to sort a file where typically (not always) the lines are whatever:[A-Ba-b0-9_]: values where fields are separated with :. Some lines do not follow this pattern, I'm not interested in them, they can be anywhere in the output. I want to…
Jav
  • 960
  • 3
  • 11
  • 23
23
votes
5 answers

Top Command - How to reduce the displayed Columns

Can we get specific column in a top command, for eg I'm interested in only the memory utilization and CPU usage column. How do I reduce the displayed columns of the top command to only the above two columns?
Surya
  • 231
  • 1
  • 2
  • 3
21
votes
11 answers

Transposing rows and columns

I have a file with the lines like below. title1:A1 title2:A2 title3:A3 title4:A4 title5:A5 title1:B1 title2:B2 title3:B3 title4:B4 title5:B5 title1:C1 title2:C2 title3:C3 title4:C4 title5:C5 title1:D1 title2:D2 title3:D3 title4:D4 title5:D5 How…
Dens
  • 211
  • 1
  • 2
  • 3
18
votes
1 answer

Formatting text into columns

I have a file with two columns as shown below(example): FILE 1: John 1 Peter 2 Michael Rod 3 Su 7 Louise 9 I need to format this and my expected output should be: FILE 1: John 1 Peter 2 Michael Rod 3 Su 7 Louise 9
Ram
  • 335
  • 1
  • 2
  • 4
16
votes
6 answers

A better paste command

I have the following two files ( I padded the lines with dots so every line in a file is the same width and made file1 all caps to make it more clear). contents of file1: ETIAM...... SED........ MAECENAS... DONEC...... SUSPENDISSE contents of…
Tulains Córdova
  • 2,926
  • 4
  • 18
  • 26
15
votes
6 answers

Combining large amount of files

I have ±10,000 files (res.1 - res.10000) all consisting of one column, and an equal number of rows. What I want is, in essence, simple; merge all files column-wise in a new file final.res. I have tried using: paste res.* However (although this seems…
mats
  • 249
  • 4
  • 9
15
votes
6 answers

Create an ASCII art table from tabular data

Given perhaps comma- or tab-delimited input, I'd like to present a series of appropriately padded columns to stdout, so I can easily scan columnar information which would otherwise present rather messily. I've tried troff-based solutions and while…
i336_
  • 1,007
  • 1
  • 10
  • 28
14
votes
2 answers

Aligning columns using awk

I am trying to align these columns super+t sticky toggle super+Shift+space floating toggle super+Shift+r restart super+Shift+d mode $mode_launcher super+Shift+c reload super+r mode resize super+Return i3-sensible-terminal super+q kill super+n…
Galilean
  • 534
  • 1
  • 6
  • 16
1
2 3
22 23