Content format in a text file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Content format in a text file
# 1  
Old 10-27-2009
Java Content format in a text file

Hi,

I need to format the content in a text file as below format. Can some one help me how to approach? Also whether is it possible to convert the output to excel in column wise?

Present:
Code:
=============================================================================
Name: vinodh
Status: active
dateofjoin: 2009/09/25 14:31:43;  course: csc
school of computing science
=============================================================================
Name: sam
Status: notactive
dateofjoin: 2009/09/25 14:31:43;  course: csc
school of computing science
=============================================================================
Name: John
Status: notactive
dateofjoin: 2009/09/25 14:31:43;  course: it
=============================================================================

Required:
Code:
Name: vinodh Status: active    dateofjoin: 2009/09/25 14:31:43; course: csc school of computing science
Name: sam    Status: notactive dateofjoin: 2009/09/25 14:31:43; course: csc school of computing science
Name: John   Status: notactive dateofjoin: 2009/09/25 14:31:43; course: it

Thanks
# 2  
Old 10-30-2009
Not very compact but works on your example:
Code:
awk '$1=$1' RS= infile| sed 's/ =\+ /\n/g; s/=\+ //g; s/ =\+//g'
Name: vinodh Status: active dateofjoin: 2009/09/25 14:31:43; course: csc school of computing science
Name: sam Status: notactive dateofjoin: 2009/09/25 14:31:43; course: csc school of computing science
Name: John Status: notactive dateofjoin: 2009/09/25 14:31:43; course: it

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to sort a content of a text file using a shell script?

I am new to shell scripting. I am interested how to know how to sort a content of a file using shell scripting. I've attached the 'Input file' and the 'expected output' to this thread. Details provided in the expected output file will provide details on how the sort needs to be done. ... (16 Replies)
Discussion started by: nkarthik_mnnit
16 Replies

2. Shell Programming and Scripting

How can I reorganize the text file content for DB import?

Dear Madam / Sir, My Boss need to reorganize :rolleyes: the text file ready for DB import, here show you the requirment and seems not difficult but how to make it by shell script or other programming language effectively. FILE1 : user1,location1,location2,locatoin3,seat1,seat2,seat3... (4 Replies)
Discussion started by: ckwong99
4 Replies

3. Shell Programming and Scripting

Change a file content format using awk

Hi, i have a file input.txt Continent North America Country USA Capital Washington D.C. Country Canada Capital Ottawa Continent South America Country Argentina Capital Buenos Aires Country Brazil Capital Brasília Coutry Colombia Capital Bogotá and i want to get an output.txt ... (3 Replies)
Discussion started by: fastlane3000
3 Replies

4. Shell Programming and Scripting

Extracting content from a file in specific format

Hi All, I have the file in this format **** Results Data **** Time or Step 1 2 20 0.000000000e+00 0s 0s 0s 1.024000000e+00 Us 0s 0s 1.100000000e+00 1s 0s 0s 1.100000001e+00 1s 0s 1s 2.024000000e+00 Us Us 1s 2.024000001e+00 ... (7 Replies)
Discussion started by: diehard
7 Replies

5. Shell Programming and Scripting

Script to create a text file whose content is the text of another files

Hello everyone, I work under Ubuntu 11.10 (c-shell) I need a script to create a new text file whose content is the text of another text files that are in the directory $DIRMAIL at this moment. I will show you an example: - On the one hand, there is a directory $DIRMAIL where there are... (1 Reply)
Discussion started by: tenteyu
1 Replies

6. UNIX for Dummies Questions & Answers

creating text file with content from script

hi, can somebody tell me how I can create a text file with content from Bash script. The file should be prefilled with information such as current date and time then leaving the user ability to input more data right below those prefilled content. thank you :) (0 Replies)
Discussion started by: s3270226
0 Replies

7. Shell Programming and Scripting

Sort content of text file based on date?

I now have a 230,000+ lines long text file formatted in segments like this: Is there a way to sort this file to have everything in chronological order, based on the date and time in the text? In this example, I would like the result to be: (19 Replies)
Discussion started by: KidCactus
19 Replies

8. Shell Programming and Scripting

Read a text file and print the content..

hello all i request you to give the solution for the following problem.. I want read the text file.and print the contents character by character..like if the text file contains google means..i want to print g go goo goog googl google like this Using unix Shell scripting... ... (7 Replies)
Discussion started by: samupnl
7 Replies

9. Shell Programming and Scripting

replace block of text with content of another file

Hello, file1: not to be changed not to be changed <start> old stuff old stuff old stuff <end> not to be changed not to be changed file2: new text new text desired output: (3 Replies)
Discussion started by: ripat
3 Replies

10. Shell Programming and Scripting

How to get content of a variable into text file (sed)?

Hello, Im working on this problem for 3 days now and i just cant get it to work.. I tried with alot of different sed methods but didnt find any solution. Its proberly verry simple but i just started bash scripting for a month or so.. i have a file called: file.nfo and file.txt the content... (4 Replies)
Discussion started by: atmosroll
4 Replies
Login or Register to Ask a Question