Format a file through unix script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Format a file through unix script
# 8  
Old 11-25-2010
Hi,

Its not about input or output..
I have file say test.txt...the data appearing in that is like below format
Code:
TT=Tab
FLN=1
FILE=business_class.txt
[Defined Tables]
class.txt=class
xol_type.txt=xol_type
vehicle_type.txt=vehicle_type
trade_class.txt=trade_class
territory_group.txt=territory_group
territory.txt=territory
surveyor.txt=surveyor
site.txt=site

It looks in same format when i 'cat test.txt'
BUT when i email this from unix to an emailid by mail command, it becomes like below:
Code:
TT=TabFLN=1FILE=business_class.txt[Defined Tables]class.txt=class
xol_type.txt=xol_typevehicle_type.txt=vehicle_type
trade_class.txt=trade_classterritory_group.txt=territory_groupterritory.txt=territory
surveyor.txt=surveyorsite.txt=site

Help on this would be much appreciated?

---------- Post updated at 08:05 PM ---------- Previous update was at 04:47 AM ----------

Any idea on my above quer please?

Last edited by Franklin52; 12-14-2010 at 04:36 AM.. Reason: Please use code tags, thank you
# 9  
Old 11-30-2010
This is done..thanks Smilie
No further help required on this.
# 10  
Old 12-14-2010
Hi Amit, I am facing the similar issue, the txt file format is changed when I email it from unix to an emailid by mail command.
Can you share the solution pls.
# 11  
Old 12-14-2010
Sure. I will love to share the solution as there is no amendments are required in your unix script. All you need to do is to change the setting of your outlook.

So here we go:
I am assuming that you are using microsoft outlook 2003.
Go to Tools-->Options-->Preferences tab-->Under E-mail section click on E-mail Options..--> Under Message heading section, uncheck "Remove extra line breaks in plain text messages.

Refresh your inbox..
This wud resolve your line alignment issue....
hope this would help.
# 12  
Old 12-15-2010
Amit, I modified the setting but still the file shows the unix spl Ctrl M char.
I generate this txt file in unix by using spool.
When I open the file in unix using vi there are no spl char and also each record is its own line. But when I email the same txt file as attachment, it has Ctrl M char and also each record is NOT in new line.
Any suggestions.
# 13  
Old 12-15-2010
"When I open the file in unix using vi there are no spl char and also each record is its own line. But when I email the same txt file as attachment, it has Ctrl M char and also each record is NOT in new line.
Any suggestions. "

--> share with me the code you are using to send the email? Are you 'cat'ing the file?
Also share the example content of the file appearing while emailing.

--> dont use vi to check the special charaters, check the contact in normal text format...either use cat, view or pg...what ever your shell supports?

--> Ctrl M character usually comes when line has not ended actually, but eventually we would like to see it in the next line. Divert the content in text format and check.

--> if nothing works out. We need to end up by writing an function to format the content to email.

Last edited by amit.mathur08; 12-15-2010 at 05:23 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX/PERL script to convert XML file to pipe delimited format

Hello, I need to get few values from a XML file and output needs to be written in another file with pipe delimited format. The Header & Footer of the Pipe Delimited file will be constant. The below is my sample XML file. I need to pull the values in between the XML tags <Operator_info to... (15 Replies)
Discussion started by: karthi1305561
15 Replies

2. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

3. Shell Programming and Scripting

UNIX shell script to format output report

i am new to unix shell scripting, could someone please help me. i was asked to develop a unix script and requirement of the script is as follows: 1. In source directory, if any new files are being dropped by external system then an email should be sent out with a message saying "files are... (3 Replies)
Discussion started by: crefi1545
3 Replies

4. Shell Programming and Scripting

Change the date and time format in UNIX script.

Hi, I am extracting a date string from the source file like this : 06/05/2014 16:04:00 I want to change it to 05-JUN-14 04.05.00.000000000 PM I basically store the date in a variable. I got solutions to change date in dd-mmm-yyyy format using tr but I guess it works only with the "date"... (8 Replies)
Discussion started by: Varshha
8 Replies

5. Shell Programming and Scripting

How to identify whether the script is in Unix format or not ?

Hi All, I have the below scenario in my environment Developers used to copy file from windows to Linux box. Some time on the copied file developers miss to run the dos2unix utility. Because of this script gets failed during the execution. Most of the failures are due to the dos2unix format... (7 Replies)
Discussion started by: kalpeer
7 Replies

6. Shell Programming and Scripting

Need a unix script to convert date into Julian format in a text file

The 6th & 7th column of the text files represents date & time. I need this to be converted in julian format using command "date +%s -d <date>". I know the command, but dont know how to use it on the script 0 dbclstr-b IXT_Web Memphis_Prod_SQL_Full Memphis-Prod-SQL-Full-Application-Backup... (4 Replies)
Discussion started by: ajiwww
4 Replies

7. Shell Programming and Scripting

Converting windows format file to unix format using script

Hi, I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix. My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies

8. Shell Programming and Scripting

Convert UNIX file format to PC format

Hi All, Is there any way to convert a file which is in UNIX format to a PC format.... Flip command can be used , apart form this command can we have any other way.... like usinf "awk" etc ..... main purpose of not using flip is that my Kshell doesnot support this comamnd.... (2 Replies)
Discussion started by: Samtel
2 Replies

9. UNIX for Dummies Questions & Answers

Convert UNIX file format to PC format

Hi All, Is there any way to convert a file which is in UNIX format to a PC format.... Flip command can be used , apart form this command can we have any other way.... like usinf "awk" etc ..... main purpose of not using flip is that my Kshell doesnot support this comamnd.... (1 Reply)
Discussion started by: Samtel
1 Replies

10. UNIX for Dummies Questions & Answers

Unix script to convert .csv file to.xls format

I have a .csv file in Unix box i need a UNIX script to convert the.csv files to.xls format. Its very urgent please help me. (1 Reply)
Discussion started by: moon_friend
1 Replies
Login or Register to Ask a Question