Sponsored Content
Full Discussion: writing into one line
Top Forums Shell Programming and Scripting writing into one line Post 302248994 by danmero on Monday 20th of October 2008 10:01:20 AM
Old 10-20-2008
Quote:
Originally Posted by Satyak
i need to write into one line , separated by commas
man tr
Code:
tr '\n' ',' < file >newfile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Accepting filename as command line param and writing to it

Hi, Is it possible to accept a filename as command line parameter and then write to that file using command redirection? i tried the below script. outputfile=`echo $1` echo "Writing to file" > 'echo $outputfile' exit $returncode but it isnt working. is there any other way to... (9 Replies)
Discussion started by: silas.john
9 Replies

2. Shell Programming and Scripting

Writing line to a file

Hi, I'm reading and writing a line from one file to another. Input line is like this: My name is David. Working on a shell script now. When I use "echo" or "print" output comes like this, My name is David. Working on a shell script now. Sample... (7 Replies)
Discussion started by: dateez
7 Replies

3. Shell Programming and Scripting

writing data in a text file at particular line

I need to write value of variable $version at a particular line in a text file. Line number is determined by another variable &line......I don't know how to do it in shell script ... (2 Replies)
Discussion started by: punitpa
2 Replies

4. Shell Programming and Scripting

writing shell script to find line of invalid characters

Hi, I have to write s script to check an input file for invalid characters. In this script I have to find the exact line of the invalid character. If the input file contain 2 invalid character sat line 10 and 17, the script will show the value 10 and 17. Any help is appreciated. (3 Replies)
Discussion started by: beginner82
3 Replies

5. Shell Programming and Scripting

writing string to specific line

I want to put a text string in file using any method on specific line line number 30 text to be put %this is location /var/www/filename (3 Replies)
Discussion started by: aliahsan81
3 Replies

6. Shell Programming and Scripting

Preserving newlines when writing loops on the command line in bash

Dear All, I have a question that's been difficult to get an answer to. I often write command line loops, e.g. find files, print name, grep for term, apply sed, etc I use both zsh and bash. When I write a loop e.g. for line in `more myfile.txt` > do > echo $line > done but... (2 Replies)
Discussion started by: JohnK1
2 Replies

7. Shell Programming and Scripting

writing in a file's particular column number of every line during runtime

Given a particular line number and a corresponding column number, can i write something in the file during run time? For example x=1 and during runtime i want to write the value of x in column 100 of every line of a given file, then how shud that be done? Thanks (9 Replies)
Discussion started by: arindamlive
9 Replies

8. UNIX for Dummies Questions & Answers

Writing a script that will take the first line from each file and store it in an output file

Hi, I have 1000 files names data1.txt through data1000.txt inside a folder. I want to write a script that will take each first line from the files and write them as output into a new file. How do I go about doing that? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies

9. UNIX for Dummies Questions & Answers

Writing a dummy line!!

Hi, I have a file whihc looks like file_1 100 200 file_2 200 300 file_4 400 500 as the file_3 is missing so I want to replace it by file_3 0 0 the final output would look like file_1 100 200 file_2 200 300 file_3 0 0 file_4 400 500 Any help is highly appreciated. Regards, (3 Replies)
Discussion started by: begin_2013
3 Replies

10. Shell Programming and Scripting

Python DictWriter header - not writing in first line of existing file

Hello I am facing a very unique problem and not able to understand why. I have written a function which will check header of the file. If header is present good else it will write the header on top def writeHeaderOutputCSV(fileName): # See if the file exist already try: ... (0 Replies)
Discussion started by: radioactive9
0 Replies
CUBRID_ROLLBACK(3)							 1							CUBRID_ROLLBACK(3)

cubrid_rollback - Roll back a transaction

SYNOPSIS
bool cubrid_rollback (resource $conn_identifier) DESCRIPTION
The cubrid_rollback(3) function executes rollback on the transaction pointed by $conn_identifier, currently in progress. Connection to server is closed after calling cubrid_rollback(3). Connection handle, however, is still valid. PARAMETERS
o $conn_identifier -Connection identifier. RETURN VALUES
TRUE, when process is successful. FALSE, when process is unsuccessful. EXAMPLES
Example #1 cubrid_rollback(3) example <?php $conn = cubrid_connect("127.0.0.1", 33000, "demodb", "dba"); cubrid_set_autocommit($conn,false); @cubrid_execute($conn, "DROP TABLE publishers"); $sql = <<<EOD CREATE TABLE publishers( pub_id CHAR(3), pub_name VARCHAR(20), city VARCHAR(15), state CHAR(2), country VARCHAR(15) ) EOD; if (!cubrid_execute($conn, $sql)) { printf("Error facility: %d Error code: %d Error msg: %s ", cubrid_error_code_facility(), cubrid_error_code(), cubrid_error_msg()); cubrid_disconnect($conn); exit; } $req = cubrid_prepare($conn, "INSERT INTO publishers VALUES(?, ?, ?, ?, ?)"); $id_list = array("P01", "P02", "P03", "P04"); $name_list = array("Abatis Publishers", "Core Dump Books", "Schadenfreude Press", "Tenterhooks Press"); $city_list = array("New York", "San Francisco", "Hamburg", "Berkeley"); $state_list = array("NY", "CA", NULL, "CA"); $country_list = array("USA", "USA", "Germany", "USA"); for ($i = 0, $size = count($id_list); $i < $size; $i++) { cubrid_bind($req, 1, $id_list[$i]); cubrid_bind($req, 2, $name_list[$i]); cubrid_bind($req, 3, $city_list[$i]); cubrid_bind($req, 4, $state_list[$i]); cubrid_bind($req, 5, $country_list[$i]); if (!($ret = cubrid_execute($req))) { break; } } if (!$ret) { cubrid_rollback($conn); } else { cubrid_commit($conn); $req = cubrid_execute($conn, "SELECT * FROM publishers"); while ($result = cubrid_fetch_assoc($req)) { printf("%-3s %-20s %-15s %-3s %-15s ", $result["pub_id"], $result["pub_name"], $result["city"], $result["state"], $result["country"]); } } cubrid_disconnect($conn); ?> The above example will output: P01 Abatis Publishers New York NY USA P02 Core Dump Books San Francisco CA USA P03 Schadenfreude Press Hamburg Germany P04 Tenterhooks Press Berkeley CA USA SEE ALSO
cubrid_commit(3), cubrid_disconnect(3). PHP Documentation Group CUBRID_ROLLBACK(3)
All times are GMT -4. The time now is 02:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy