Sponsored Content
Top Forums UNIX for Dummies Questions & Answers appending a command to print a file in a comma delimited format Post 302712969 by prodigy06 on Wednesday 10th of October 2012 05:36:14 AM
Old 10-10-2012
appending a command to print a file in a comma delimited format

Hi everyone,

i have a file that I had grep'd from something else lets call it file1.txt which consists variable files and lines due to different scenarios/inputs
Code:
1782
9182
fe35
ac67

how can I print this in this manner?
Code:
1782,9182,fe35,ac67

also if i had piped the new output to a file say file2.txt, how can i call file2.txt using printf? please help. thanks a lot.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comma Delimited file

I have a comma delimited file that sometimes has addresses details in. The problem is that the address detail can be seen as: "Sample House, Sample Road". When I run a script specifying the file is comma delimited I would like it to ignore comma's that are in between speech marks. Is this... (2 Replies)
Discussion started by: dbrundrett
2 Replies

2. Shell Programming and Scripting

Converting Tab delimited file to Comma delimited file in Unix

Hi, Can anyone let me know on how to convert a Tab delimited file to Comma delimited file in Unix Thanks!! (22 Replies)
Discussion started by: charan81
22 Replies

3. Shell Programming and Scripting

how to convert this file into comma delimited format

Hi experts, I need urget help! I have the a text file with this format: Types of fruits Name of fruits 1,1 Farm_no,1 apple,1 pineapple,1 grapes,1 orange,1 banana,1 2,2--->this is the record seperator Farm_no,2 apple,1 pineapple,1 grapes,3 orange,2 banana,1 3,3--->this is the... (1 Reply)
Discussion started by: natalie23
1 Replies

4. UNIX for Advanced & Expert Users

Urgent! need help! how to convert this file into comma delimited format

Hi experts, I need urget help! I have the a text file with this format: Types of fruits Name of fruits 1,1 Farm_no,1 apple,1 pineapple,1 grapes,1 orange,1 banana,1 2,2--->this is the record seperator Farm_no,2 apple,1 pineapple,1 grapes,3 orange,2 banana,1 3,3--->this is the... (2 Replies)
Discussion started by: natalie23
2 Replies

5. UNIX for Dummies Questions & Answers

Comma delimited file

Hi All, I have output of sql saved in comma separated file. Now i need to read line by line this file and assign word to a unix variable for further processing Eg: Test file world, 1, 3, 4 earth,2,3,4,5 moon,1,2,3,4 Output should be word1= world word2=1 echo " first word... (7 Replies)
Discussion started by: gwrm
7 Replies

6. Shell Programming and Scripting

Remote command output to file comma delimited

All, I am trying to run a command that will get the serial number, model, and hostname of a server and then output the 3 fields comma delimited. Then a new line to separate the 3 fields for each host. So, I run a for loop that reads in the list of hosts in a file and then runs these sudo... (0 Replies)
Discussion started by: markdjones82
0 Replies

7. Shell Programming and Scripting

Print records which do not have expected number of fields in a comma delimited file

Hi, I have a comma (,) delimited file, in which few fields are enclosed with in double quotes " ". I have to print the records in the file which donot have expected number of field with the line number. File1 ==== name,desgnation,doj,project #header#... (7 Replies)
Discussion started by: machomaddy
7 Replies

8. Shell Programming and Scripting

Comma delimited file manipulation

Question about how to change the first & last name in column one & two so that the names have a capital letter for just the first letter. Example: asdf@asdf.com,asdf,asdfasdf,176.23.22.345,4/12/2012 changed to: asdf@asdf.com,Asdf,Asdfasdf,176.23.22.345,4/12/2012 Thank you kindly, Nick (2 Replies)
Discussion started by: nickytcom
2 Replies

9. Shell Programming and Scripting

Need a script to convert comma delimited files to semi colon delimited

Hi All, I need a unix script to convert .csv files to .skv files (changing a comma delimited file to a semi colon delimited file). I am a unix newbie and so don't know where to start. The script will be scheduled using cron and needs to convert each .csv file in a particular folder to a .skv... (4 Replies)
Discussion started by: CarpKing
4 Replies

10. Shell Programming and Scripting

Help/Advise please for converting space delimited string variable to comma delimited with quote

Hi, I am wanting to create a script that will construct a SQL statement based on a a space delimited string that it read from a config file. Example of the SQL will be For example, it will read a string like "AAA BBB CCC" and assign to a variable named IN_STRING. I then concatenate... (2 Replies)
Discussion started by: newbie_01
2 Replies
sdiff(1)						      General Commands Manual							  sdiff(1)

NAME
sdiff - Compares two files and displays the differences in a side-by-side format SYNOPSIS
sdiff [-l | -s] [-w number] [-o output_file] file1 file2 The sdiff command reads file1 and file2, uses diff to compare them, and writes the results to standard output in a side-by-side format. OPTIONS
Displays only the left side when lines are identical. Creates a third file, output_file, by a controlled interactive line-by-line merging of file1 and file2. The following subcommands govern the creation of this file: Adds the left side to output_file. Adds the right side to output_file. Stops displaying identical lines. Begins displaying identical lines. Enters ed with the left side, the right side, both sides, or an empty file, respectively. Each time you exit from ed, sdiff writes the resulting edited file to the end of output_file. If you fail to save the changes before exiting, sdiff writes the initial input to output_file. Exits the interactive session. Suppresses display of identical lines. Sets the width of the output line to number (130 characters by default). DESCRIPTION
The sdiff command displays each line of the two files with a series of spaces between them if the lines are identical, a < (left angle bracket) in the field of spaces if the line only exists in file1, a > (right angle bracket) if the line only exists in file2, and a | (ver- tical bar) for lines that are different. When you specify the -o option, sdiff produces a third file by merging file1 and file2 according to your instructions. Note that the sdiff command invokes the diff -b command to compare two input files. The -b option causes the diff command to ignore trail- ing spaces, tab characters, and consider other strings of spaces as equal. EXAMPLES
To print a comparison of two files, enter: sdiff chap1.bak chap1 This displays a side-by-side listing that compares each line of chap1.bak and chap1. To display only the lines that differ, enter: sdiff -s -w 80 chap1.bak chap1 This displays the differences at the tty. The -w 80 sets page width to 80 columns. The -s option tells sdiff not to display lines that are identical in both files. To selectively combine parts of two files, enter: sdiff -s -w 80 -o chap1.combo chap1.bak chap1 This combines chap1.bak and chap1 into a new file called chap1.combo. For each group of differing lines, sdiff asks you which group to keep or whether you want to edit them using ed. SEE ALSO
Commands: diff(1), ed(1) sdiff(1)
All times are GMT -4. The time now is 05:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy