concatenation

Concatenate multiple files but include filename as section headers

泪湿孤枕 提交于 2019-11-29 18:32:54
I would like to concatenate a number of text files into one large file in terminal. I know I can do this using the cat command. However, I would like the filename of each file to precede the "data dump" for that file. Anyone know how to do this? what I currently have: file1.txt = bluemoongoodbeer file2.txt = awesomepossum file3.txt = hownowbrowncow cat file1.txt file2.txt file3.txt desired output: file1 bluemoongoodbeer file2 awesomepossum file3 hownowbrowncow DS. Was looking for the same thing, and found this to suggest: tail -n +1 file1.txt file2.txt file3.txt Output: ==> file1.txt <==

My python code that converts numbers between bases has several errors. What could be wrong and how can I find them?

浪子不回头ぞ 提交于 2019-11-29 18:08:21
My program is a function that converts numbers from one base to another. It takes three arguments: the initial value, the base of the initial value, then the base it is to be converted to. The thing has several errors. For one, the thing won't accept any value that contains a letter for cnum. I don't know why. And I can't seem to figure out how to force the thing to recognize the argument 'cnum' as a string within the function call. I have to convert it into a function in the code itself. Also, I can't get the second half, the part that converts the number to the final base, to work. Either it

Notice : Undefined variable when concatenating

落爺英雄遲暮 提交于 2019-11-29 17:28:45
I have been making a script to display users and make changes to their admin privileges. Here is the code: while ($row= mysql_fetch_assoc($query)) { $uname= $row['username']; $fname= $row['first_name']; $lname= $row['last_name']; $email= $row['email']; $admin= $row['admin']; $insert .= '<tr> <td>' .$uname. '</td> <td>' .$fname. '</td> <td>' .$lname. '</td> <td>' .((isset($email)) ? $email:'No email set.'). '</td> <td>'.(($admin == 'y') ? 'Admin':'User').'</td> <td><input type="checkbox" name="' .$uname. '" value="'.(($admin == 'y')?'n':'y').'"/>'.(($admin == 'y')?'Make a user':'Make an admin

How to concatenate data from one field, in a comma-delimited list, in a many-to-many relationship in MySQL?

馋奶兔 提交于 2019-11-29 17:26:56
问题 I have a many-to-many relationship between People and Departments since one person can be in many departments. People Departments ------ ----------- pID pName deptID deptName 1 James 1 Engineering 2 Mary 2 Research 3 Paul 3 Marketing 4 Communications People_Departments ------------------ pID deptID 1 1 1 2 2 2 2 4 3 1 3 2 3 3 What I want is this: pName deptName James Engineering, Research Mary Research, Communication Paul Engineering, Research, Marketing If I do plain LEFT JOINs on the tables

Excel concatenate

筅森魡賤 提交于 2019-11-29 17:09:29
I would like to concatenate data from two cells into one cell. I would also like to only combine those cells that have the same ID. Task ID Name 4355.2 Participant 4355.2 Leader 4462.1 Online 4462.1 Quick 4597.1 Slide 4597.1 One Page 4597.1 One Topic For example, for this, I would like a cell for 4355.2 with "Participant, Leader" as the data in that cell. The same type of data for 4462.1 with "Online and Quick" as the data for that cell. Task ID Name 4355.2 Participant, Leader Is there a way to do that in Excel? 4462.1 Online, Quick Assuming your data is in A1:B8 , and sorted. in C2, =IF(OR(A2

Concatenate a selected column in a single query?

怎甘沉沦 提交于 2019-11-29 17:06:12
I know you can do this, because I've seen it done once before, but I forget where and up until now I haven't need to do it. I have a table called Employees, and it has various employee data (duh). I need a query that will do a select on the first and last name of all rows in the table, and then contenate all of them into a comma delimited string. For example, I have a few rows (a lot more than that actually, but for the sake of this question just assume two) of data that look like: FName LName ------- ----- Richard Prescott Jill Sentieri Carol Winger I need to a select that can return the

Using C preprocessor to construct a string literal for scanf?

橙三吉。 提交于 2019-11-29 17:02:36
I'm attempting to create an sscanf string literal to aid in buffer overrun prevention in C99. The goal is something like: #define MAX_ARG_LEN 16 char arg[MAX_ARG_LEN] = ""; if (sscanf(arg, "%"(MAX_ARG_LEN-1)"X", &input) > 0) The obvious "manual" solution is something like: #define MAX_ARG_LEN 16 #define MAX_ARG_CHARS "15" char arg[MAX_ARG_LEN] = ""; if (sscanf(arg, "%"MAX_ARG_CHARS"X", &input) > 0) However, I would prefer something to automatically generate "%15X" given a buffer size of 16. This link is almost works for my application: Convert a preprocessor token to a string but it does not

r - how to use a variable in a variable

时光总嘲笑我的痴心妄想 提交于 2019-11-29 17:01:54
I have a data frame where the row names are words and I can call the first column of that row of data drame using something like >df['rowB',1] i know I can use paste to combine a variable and a string using paste to do something like >paste("the value is ", df['rowB',1], "."] and that will get me an output of the string with the value of the variable. what if rowname is a variable that equals 'rowB? I tried to do a first paste to put in the paste above, but the result of the first paste doesn't evaulate to the value, but rather is just a string that says >rowname<-'rowB' >type<-paste("relatype

Concatenate Rows in Microsoft Access

孤街浪徒 提交于 2019-11-29 16:50:39
The basic idea is that I have a table in this form in Access 2007: Company Name | Address | Product Company A 123 Fakestreet Phone Company A 123 Fakestreet Computer Company A 123 Fakestreet Car Company B 456 Fakestreet Football Company B 456 Fakestreet Basketball Company B 456 Fakestreet Golf Ball And I want it to be in this form: Company Name | Address | List of Products Company A 123 Fakestreet Phone, Computer, Car Company B 456 Fakestreet Football, Basketball, Golf Ball I tried using Allen Browne's ConcatRelated function ( http://allenbrowne.com/func-concat.html ), and at first it wouldn't

Javascript: “+” sign concatenates instead of giving sum of variables

懵懂的女人 提交于 2019-11-29 16:17:51
I am currently creating a site that will help me quickly answer physics questions. As it happens, the code didn't run as expected, here is the code if (option == "dv") { var Vinitial = prompt("What is the Velocity Initial?") var acceleration = prompt("what is the acceleration?") var time = prompt("what is the time?") Vfinal = Vinitial + acceleration * time displayV.innerHTML = "v= vf= " + Vfinal + "ms" + sup1.sup(); } Now, let's say Vinitial was 9, acceleration was 2, and time was 3. When the code runs, instead of getting 15 for "Vfinal", I get 96. I figured out that it multiplies acceleration