FAQ Database Discussion Community


Removing carriage return and tab escape sequences from string in Bash

bash,tr
Assume I have this string: Your name is\nBobby\tBlahck\r\r how can I remove the characters "\n, \t, \r". The string literally looks like that, it does not contain tabs or new lines. They are only characters. When I try echo "Your name is\nBobby\tBlahck\r\r" | tr -d '\t' tr assumes I am...

Is it wise or acceptable to create a table with a different number of columns (td) for each row (tr)

html,table,html-table,tr
I was wondering if it is wise or acceptable to create a table with a different number of columns (td) for each row (tr) using html. For example: <table> <tr> <td>title</td> </tr> <tr> <td>text</td> <td>and more text</td> </tr> </table> Do I have to include the colspan? ...

How to get value of one of from several using jQuery?

jquery,html5,table,tr
I have got the next code: <tr> <td id='type'> Type name </td> <td id='number'> 102030 </td> <td id='software'> 1.0-Alpha </td> </tr> I need to get value of td with id 'number'. I use the next code right now and it works: $('tbody tr').click(function() { var tdNumber = $(this).find('td:nth-child(2)').html(); }); But...

Replacing newline character in a field in csv file

csv,awk,sed,tr
I have a CSV file with 165 columns and I have a problem. I need to replace \r\n characters with a blank space from the columns but not from the end of line as it is the record separator. Input: 001|Baker St. London|3|4|7 002|Penny Lane Liverpool|88|5|7 Output: 001|Baker St. London|3|4|7...

Remove commas and format dates

awk,sed,grep,tr,nawk
I have a large file with entries such as: <VAL>17,451.26</VAL> <VAL>353.93</VAL> <VAL>395.00</VAL> <VAL>2,405.00</VAL> <DATE>31 Jul 2013</DATE> <DATE>31 Jul 2013</DATE> <DATE>31 Dec 2014</DATE> <DATE>21 Jun 2002</DATE> <DATE>10 Jul 2002</DATE> <MOD>PL</MOD> <BATCH>13382</BATCH> <TYPE>Invoice</TYPE> <REF1>13541/13382</REF1> <REF2>671042638320</REF2>...

get dynamic value every value of td of tr jquery

javascript,jquery,html,html-table,tr
$("#student").find("tr:gt(0)").remove(); for (var i = 0; i < data.length; i++) { tr = $('<tr/>'); tr.append("<td id='id'>" + "<a class=\"school_id\" id=" + data[i].id + " href='#' value='" + data[i].id + "'>" + data[i].id + "</a>" + "</td>"); tr.append("<td id='lastname'>" + data[i].lastname + "</td>"); tr.append("<td id='firstname'>" + data[i].firstname + "</td>"); //$("#td_id").attr('width', '15%');...

Jquery split on row does not work if null

jquery,html-table,tr
Trying to break a td text on | symbol and display as- http://jsfiddle.net/XFC5u/102/ function addBR($el) { $el.html($el.html().split('|').join('<br/>')); } addBR($('.myClass')); my issue is when first myClass value is null it shows all following row value null. like- http://jsfiddle.net/XFC5u/121/ Doing something wrong in looping?? please suggest....

Dynamic HTML row - add id on TR

javascript,html,table,tr
How to add an ID (value 1, 2, 3, etc.) on each new I have now so that my script creates a new row, but would need an ID to each FIDDLE CODE: function deleteRow(tableID) { try { var table = document.getElementById(tableID); var rowCount = table.rows.length; for(var i=0; i<rowCount; i++)...

How to split a table row with jQuery (insert TR between TD's)

jquery,table,tr
I have some problem splitting a table with jQuery This is the table: <table width="100%" id="submenu"> <tr> <td class="submenu">A</td> <td class="submenu">B</td> <td class="submenu">C</td> <td class="submenu">D</td> <td class="submenu">E</td> <td class="submenu">F</td> <td class="submenu">G</td> <td class="submenu">H</td> </tr> </table> I want to make it look like this after I call a function: <table width="100%"...

Unable to add style class or access elements' attributes from jquery each loop

javascript,jquery,html,tr
I have a table, which looks like this <table id="ctoTable" class="table table-bordered"> <thead> ... </thead> <tbody> <tr></tr> <tr id="kpi#1" class="js-editable"></tr> <tr id="kpi#2" class="js-editable"></tr> <tr id="kpi#3" class="js-editable"></tr> <tr id="kpi#4" class="js-editable"></tr> <tr id="kpi#5" class="js-editable"></tr> <tr id="kpi#6" class="js-editable"></tr> <tr id="kpi#7" class="js-editable"></tr>...

Can't replace '\n' with '\\' for whatever reason

sed,backslash,tr
I have a whole bunch of files, and I wish to change something like this: My line of text My other line of text Into My line of text\\ My other line of text Seems simple, but somehow it isn't. I have tried sed s,"\n\n","\\\\\n", as well as tr '\n'...

Unwrap paragraphs while deleting spaces

linux,sed,tr
I've reached a frustrating end trying to figure out how to change the formatting of a file using sed, tr, etc. I'm sure there's some right answer to do what I want to do, I just don't know what it is. Here's my problem. I have a data file that...

JavaScript: how to hide multiple (thousands) rows in the html table

javascript,html,hide,show,tr
I have html page with many rows (is about 40000) <html><body> <table id="t1"> <tr id="r1" name="1"><td>row 1</td></tr> <tr id="r2" name="1"><td>row 2</td></tr> .... <tr id="r50000" name="3"><td>row 30000</td></tr> </table></body></html> I need a fast way to hide/show set of rows (10 000 or 20 000) with the specified name. Platform requirements: IE8-9 and...

Join multiple rows with specific delimiter to one row

perl,shell,awk,sed,tr
I want to join multiple rows in that case there always 4 after the delimiter, but that doesn't mean in the future one of then can be with more of 4 rows. Anyway I want to join them in one row when use that delimiter -- and to exclude him...

Anchor to specific tr in a table

javascript,jquery,html,tr
I have a scroll-able HTML table and based on the data on the table I want the table to start showing from a particular <tr>. The rows above can be shown upon scroll. But when the page loads, I need to position to a particular <tr> I'm able to fetch...

Exclude the last-but-one field [closed]

bash,awk,sed,cut,tr
How to exclude or remove the word before the last word in line: Example: var=1 echo "list $var M" Expected: list 1M ...