how to organise a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to organise a file
# 1  
Old 08-12-2010
how to organise a file

I have a file with only one record and the file size would be around 80 MB.

Is there a way, where I can read and write this to a file with only 80bytes in each row
# 2  
Old 08-12-2010
Have you tried the fold command?

Check your man page for the options.
# 3  
Old 08-12-2010
I forgot the command. I could get the result now...Thanks
# 4  
Old 08-12-2010
Assuming that this file consists solely of ascii printable characters and there are no line-feed characters anywhere in the file we should be able to use "dd" to produce a file with 80 character fixed-length records with each record terminated with a line-feed. If the file is not an exact multiple of 80 bytes be sure to check the last two records very carefully.
This approach is of little value for binary files.

Code:
dd if=inputfile.txt of=outputfile.txt obs=80 cbs=80 conv=unblock

It can be easier to write a program in the programming language which wrote the file to create the file in a more useful format. Or use the original programming language to read back the file and convert it.


Check any syntax against your Operating System. It always helps to know what you have.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies

2. UNIX for Beginners Questions & Answers

organise mailing lists in email client

mr macos please bare with me i couldnt find a place to post my issue and hence m posting it here How do you organise mailing lists in your email client? How do you guys organise your mailing lists? I'm having a few issues with my set up: When I subscribe to a mailing list I add a rule in the... (2 Replies)
Discussion started by: georgekhaidas
2 Replies

3. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

4. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

5. Shell Programming and Scripting

How do you organise home with a script?

Hi, I am helping my dad with his computer and he has the messiest folder organisation imaginable. Would it be possible to create a script which moves all images not in the Pictures folder to pictures, all documents not in Documents to Documents, videos to Videos etc? But of course... (7 Replies)
Discussion started by: foxyfennec
7 Replies

6. Programming

How I organise my project in unix environment.

I want develop a library in solaris, I want to know where the source and header files that I coded should place at. Thank you in advance for your comment. (0 Replies)
Discussion started by: nianzhe
0 Replies
Login or Register to Ask a Question