Insert a column in the beginning

Tags
advanced, beginning, colum, column, html, insert, table, unix

 
Thread Tools Search this Thread
# 1  
Old 11-20-2018
Insert a column in the beginning

Hi, I have been trying to see how i can insert a column in the beginning to my html table

This is how it looks

Code:
Name Age 
Sid     32   
John   33
Mary   34

I want to insert a column Job before Name column, so it looks like

Code:
Job      Name   Age 
IT        Sid       32   
Doctor John     33
Nurse   Mary    34

I tried with
HTML Code:
<thead><tr>Job</tr></thead>
<tr><td>IT</td></tr>
<tr><td>Doctor</td></tr>
<tr><td>Nurse</td></tr>
but the output looks
Code:
Job
IT
Doctor
Nurse
Name Age 
Sid     32   
John   33
Mary   34

# 2  
Old 11-20-2018
You will need to arrange it like <tr><td>column1</td><td>column2</td><td>column3</td></tr>

If you mean you want an automatic solution, what format do you have your input data in?
# 3  
Old 11-20-2018
Thanks for the reply, however this would insert one row and the different columns.

I have it as space delimited columns as the raw file
# 4  
Old 11-20-2018
Code:
<table>
  <tr>
    <th>Job</th>
    <th>Name</th> 
    <th>Age</th>
  </tr>
  <tr>
    <td>IT</td>
    <td>Sid</td>
    <td>32</td>
  </tr>
  <tr>
    <td>Doctor</td>
    <td>John</td>
    <td>33</td>
  </tr>
  <tr>
    <td>Nurse</td>
    <td>Mary</td>
    <td>34</td>
  </tr>
</table>


|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
How to insert new column with awk? transat Shell Programming and Scripting 3 04-24-2017 06:00 PM
Insert text at the beginning of every even number line bob123 Shell Programming and Scripting 5 04-04-2016 03:01 PM
Insert data in first column(if blank) from previous line first column jaydeep_sadaria Shell Programming and Scripting 7 06-06-2014 08:05 AM
One of the awk column spilling on the new line from beginning grish Shell Programming and Scripting 5 08-28-2013 06:06 AM
Insert text into specific column alegnagrp Shell Programming and Scripting 6 12-24-2012 06:50 AM
Insert output from a file to beginning of line with sed diesel88 Shell Programming and Scripting 4 10-01-2012 01:49 PM
Insert at the beginning of odd lines drbiloukos Shell Programming and Scripting 7 09-11-2012 06:00 AM
Insert comma in place of column manigrover Shell Programming and Scripting 5 08-13-2012 03:29 AM
SED - insert space at the beginning of line and multi replace command piynik Shell Programming and Scripting 5 07-12-2012 01:47 PM
Need to insert text(constant) at the beginning of file jclanc8 Shell Programming and Scripting 2 06-24-2012 01:00 AM
Insert and shifting data at column psychop13 Shell Programming and Scripting 12 04-19-2012 10:49 PM
insert a column into file kush UNIX for Dummies Questions & Answers 2 03-01-2012 12:37 PM
Insert two strings at the beginning and at the end of each line of a file Linux-fueled Shell Programming and Scripting 3 10-14-2008 01:26 PM
insert text into column knoxo Shell Programming and Scripting 1 03-31-2008 06:01 AM
How to insert tab at specified column.HELP sslr UNIX for Dummies Questions & Answers 7 09-21-2007 11:54 AM