Output only first 400 bytes of a huge text file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Output only first 400 bytes of a huge text file
# 1  
Old 04-27-2012
Output only first 400 bytes of a huge text file

How do I output only the first 400 bytes of a huge text file to a new file.

It has to be unmodified so no added invisible characters.

Many thanks.....
# 2  
Old 04-27-2012
This will grab the first 400 bytes completely raw.
Code:
dd if=hugetextfile of=outputfile bs=400 count=1

# 3  
Old 04-27-2012
Hi

Code:
head -c400 file

Guru.
# 4  
Old 04-27-2012
You would have to look at the man pages of head (syntax varies depending flavour...e.g. HP-UX would be : head -c -n 400 ) but it is the -c option you will need...
Corona's proposal will give a strict one record file of 400 bytes (sure no other char will be added...)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Filter records in a huge text file from a filter text file

Hi Folks, I have a text file with lots of rows with duplicates in the first column, i want to filter out records based on filter columns in a different filter text file. bash scripting is what i need. Data.txt Name OrderID Quantity Sam 123 300 Jay 342 498 Kev 78 2500 Sam 420 50 Vic 10... (3 Replies)
Discussion started by: tech_frk
3 Replies

2. UNIX for Dummies Questions & Answers

X bytes of 0, Y bytes of random data, Z bytes of 5, T bytes of 1. ??

Hello guys. I really hope someone will help me with this one.. So, I have to write this script who: - creates a file home/student/vmdisk of 10 mb - formats that file to ext3 - mounts that partition to /mnt/partition - creates a file /mnt/partition/data. In this file, there will... (1 Reply)
Discussion started by: razolo13
1 Replies

3. Shell Programming and Scripting

How to open a huge text file?

Hi. I have a 10 Gb text file.the default text editor in ubuntu doens't open it. Does anyone know how can i open it?? Thanks (4 Replies)
Discussion started by: stalaei
4 Replies

4. Shell Programming and Scripting

Replacing in huge text file

I have huge text files (~120 MB)x100 which equivalents to ~11GB of data. The files contain pure numbers, actually the value of "phi" to 10 billion digits!! I know its huge!! Here are the last few lines of a file 0952899155 3233967444 3344925499 0276061529 7261968933 9683989044 3317145063... (14 Replies)
Discussion started by: shantanuthatte
14 Replies

5. Shell Programming and Scripting

Dynamic output file generation using a input text file with predefined output format

Hi, I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format. Example: File.txt AP|{SSHA}VEEg42CNCghUnGhCVg== APVG3|{SSHA}XK|"password" AP3|{SSHA}XK|"This is test" .... etc --------- test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies

6. Solaris

how we can calculate this bytes(55207936) in to MB(output=26957)

root@erpdevserver $ vxassist -g devdg maxsize Maximum volume size: 55207936 (26957Mb) This is the output in vxvm(3.1).. my question is how we can calculate this bytes(55207936) in to MB(output=26957) or in GB.plz tell how to calculate (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

7. Shell Programming and Scripting

Remove first N bytes and last N bytes from a binary file on AIX.

Hi all, Does anybody know or guide me on how to remove the first N bytes and the last N bytes from a binary file? Is there any AWK or SED or any command that I can use to achieve this? Your help is greatly appreciated!! Best Regards, Naveen. (1 Reply)
Discussion started by: naveendronavall
1 Replies

8. Shell Programming and Scripting

AIX/HPUX - Need to get the last few bytes of a text

Hi guys, I am in need of a simple, (typically one-liner) script to get the last 17 bytes of a line. Eg. echo "abcdefghijklmnopqrstuv" here i would need the last 17 bytes of the text ie. fghijklmnopqrstuv The text length is dymanic (but always more than 17)...it can even span upto... (2 Replies)
Discussion started by: n_rajitr
2 Replies

9. UNIX for Dummies Questions & Answers

How to remove FIRST Line of huge text file on Solaris

i need help..!!!! i have one big text file estimate data file size 50 - 100GB with 70 Mega Rows. on OS SUN Solaris version 8 How i can remove first line of the text file. Please suggest me for solutions. Thank you very much in advance:) (5 Replies)
Discussion started by: madoatz
5 Replies

10. Solaris

cron output = 0 bytes

I have a cron job set to run a script everyday. If I run the script out side of cron it runs correctly. If cron runs the script is produces a 0 byte file and it puts the output in the / directory. The script is set to put the output in a specific directory. Any help would be appreciated. (8 Replies)
Discussion started by: mbattreall
8 Replies
Login or Register to Ask a Question