Sponsored Content
Top Forums Shell Programming and Scripting Formatting File having big single line into 95 Char Per Line Post 302724413 by lancesunny on Wednesday 31st of October 2012 03:11:10 PM
Old 10-31-2012
vbe Thanks for you help regarding this.
I ma sorry but when I execute this command I get either file not found or 0+0 records in & o bytes copied.

Code:
dd if=<File1.dat> of=<File1Final.dat> cbs=95 conv=unblock

Here File1 is the file name
File1Final.dat trying to copy finalize contents to new file.
Thanks,
Lance

Last edited by lancesunny; 10-31-2012 at 04:43 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Formatting a text file to get data in exact line by line

I have my data something like this SERIAL FIRSTOCCURRENCE NETPROTOCOL 1947430693 07/01/2009 05:16:40 FR SERIAL FIRSTOCCURRENCE NETPROTOCOL 1947430746 07/01/2009 05:18:05 FR I want the output as follows.... (1 Reply)
Discussion started by: rdhanek
1 Replies

2. Shell Programming and Scripting

how first char in odd line and second char in even line

Hi I m having ifconfig -a o/p like sbanlab1:ksh# ifconfig -a | egrep "flags|inet" | awk -F' ' '{print $1,$2}' lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> inet 127.0.0.1 lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> inet 127.0.0.1 bge0:... (1 Reply)
Discussion started by: tarunn.dubeyy
1 Replies

3. Shell Programming and Scripting

Help substituting text in a file having a single line but no newline char

Hello, Need help substituting a particular word in a file having a single line but no newline character at the end. I was trying to use sed but it doesn't work probably because there is no newline char at the end of the line. $ cat hlq_detail /outputs/alvan23/PDFs/bills $ cat... (5 Replies)
Discussion started by: Shan_u2005
5 Replies

4. Shell Programming and Scripting

awk concatenate every line of a file in a single line

I have several hundreds of tiny files which need to be concatenated into one single line and all those in a single file. Some files have several blank lines. Tried to use this script but failed on it. awk 'END { print r } r && !/^/ { print FILENAME, r; r = "" }{ r = r ? r $0 : $0 }' *.txt... (8 Replies)
Discussion started by: sdf
8 Replies

5. UNIX for Dummies Questions & Answers

Remove First Char from Line in File Only if it's a comma

I have a file, I need to remove the first character of each line, but only if it's a comma. I don't want to delete any other commas in each line. Trying cat or sed but I really don't know them very well, would love some help. This removes the first comma, but it removes the first comma no... (6 Replies)
Discussion started by: Cynthia
6 Replies

6. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies

7. Shell Programming and Scripting

How to separate one line to mutiple line based on one char?

Hi Gurus, I need separate one file which is one huge line to mutiple line. file like abcd # bcd # def # fge # ged I want to get abcd bcd def fge ged Thanks in advance (4 Replies)
Discussion started by: ken6503
4 Replies

8. UNIX for Dummies Questions & Answers

To find and display the middle line in a file using single line command.

Hi all, How can i display the middle line of a file using a single line command? (6 Replies)
Discussion started by: Lakme Pemmaiah
6 Replies

9. UNIX for Beginners Questions & Answers

Output to file print as single line, not separate line

example of problem: when I echo "$e" >> /home/cogiz/file.txt result prints to file as:AA BB CC I need it to save to file as this:AA BB CC I know it's probably something really simple but any help would be greatly appreciated. Thank You. Cogiz (7 Replies)
Discussion started by: cogiz
7 Replies

10. Shell Programming and Scripting

Issues formatting output of two commands in a single line.

I wish to generate output of two commands in the same line separated by a single white-space. Below is my command and output in the same line. ls -ltr fname1.out | awk '{$2=$4=$5=x; print}' | tr '\n' '\t' | tr -s ' '; cksum<fname1.out | cut -d' ' -f1 Output: -rw-r--r--. root Aug 26 16:57... (6 Replies)
Discussion started by: mohtashims
6 Replies
dd(1)							      General Commands Manual							     dd(1)

NAME
dd - Converts and copies a file SYNOPSIS
dd [option=value...] STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: dd: XCU5.0, SVID 4 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
None OPERANDS
The option=value operand set may take any of the following forms: Specifies the input file name; standard input is the default. Specifies the output file name; standard output is the default. For the above operands, the application must supply an expression specifying a size in bytes. The expression, expr can be: a positive decimal number a positive decimal number followed by k specifying mutiplication by 1024 a positive decimal number followed by b specifying multiplication by 512 two or more positive decimal numbers with or without k or b seper- ated by x, specifying the product of the indicated values. All the operands will be processed before any input is read. Skips number input records before starting copy. [Tru64 UNIX] Copies number input files before terminating (makes sense only where input is a magnetic tape or similar device). [Tru64 UNIX] Seeks to the numberth record from the beginning of input file before copying. [Tru64 UNIX] Seeks to the numberth record from the beginning of output file before copying. Same as seek=number. Seeks to the numberth record from the beginning of output file before copying. Same as oseek=number. Copies only number input records. Specifies one or more of the following conversions: Converts EBCDIC to ASCII. Converts variable-length records to fixed-length. Converts ASCII to EBCDIC. Converts IBM-EBCDIC to ASCII. Performs a slightly different map of ASCII to EBCDIC. Converts fixed-length records to variable-length. Makes all alphabetic characters lower case. Makes all alphabetic characters upper case. Swaps every pair of bytes. Does not stop processing on an error. Pads every input record to ibs. [Tru64 UNIX] Creates a sparse output file as described in AdvFS Administration. Do not truncate the output file. Preserve blocks in the output file not explicitly written by this invocation of the dd utility. (See the of=output_file oper- and.) Allows several comma-separated conversions. DESCRIPTION
The dd command reads the specified input file or standard input, does the specified conversions, and copies it to the specified output file or standard output. The input and output block size may be specified to take advantage of raw physical I/O. The terms block and record refer to the quantity of data read or written by dd in one operation and are not necessarily the same size as a disk block. Where sizes are specified, a number of bytes is expected. A number may end with w, b, or k to specify multiplication by 2, 512, or 1024, respectively; a pair of numbers can be separated by an x to indicate a product. The cbs specification is used if one of the following conversions is specified: ascii, unblock, ebcdic, ibm, or block. For the first two conversions, dd places characters in a conversion buffer of size cbs, converts these characters to ASCII, trims trailing spaces, and adds newline characters before sending data to the specified output. For the latter three cases, dd places ASCII characters in the conversion buffer, converts these characters to EBCDIC, and adds trailing spaces to create an output record of size cbs. After it finishes, dd reports the number of whole and partial input and output blocks. NOTES
[Tru64 UNIX] To copy to a raw disk, the disk label must first be zeroed using the disklabel -z command. For example: disklabel -z disk/cdrom17 [Tru64 UNIX] If you do not zero out the disk label, dd fails with the following error message: dd write error: Read-only file sys- tem The ASCII/EBCDIC conversion tables are taken from the 256 character standard in the CACM November, 1968. There is no universal standard for EBCDIC/ASCII translation. [Tru64 UNIX] One must specify conv=noerror,sync when copying raw disks with bad sectors to ensure dd stays synchronized. [Tru64 UNIX] Certain combinations of arguments to conv= are permitted. However, the block or unblock option cannot be combined with ascii, ebcdic, or ibm. Invalid combinations silently ignore all but the last mutually exclu- sive keyword. [Tru64 UNIX] If you need to use dd to copy to a streaming tape and the data is an odd length (not a multiple of 512 bytes), you must use the conv=sync flag to fill the last record. Streaming tape devices permit only multiples of 512 bytes. [Tru64 UNIX] If option bs is used (or bs is equal to obs) and no conversion is specified, then dd is particularly efficient since less memory copies are done. [Tru64 UNIX] The dd command does not support floppy disk multivolumes, but it does support tape multivol- umes. This means that when ENOSPC is returned while reading or writing a tape, dd will prompt the user for a new tape. [Tru64 UNIX] In order to make use of tape multivolumes, the files option must be used. Security Note [Tru64 UNIX] Any file system archive that contains ACLs (access control lists) that was created using dd is not exportable unless the tar- get system has the exact same password and group files. If there is a mismatch, incorrect access may be granted to a file or directory. EXIT STATUS
The following exit values are returned: The input file was successfully copied. An error occurred DIAGNOSTICS
This message specifies the number of full and partial records both read and written: f+p records in f+p records out The number of full records read or written (f) refers to the blocks of data of size ibs or obs. The number of partial records read or written (p) refers to the blocks of data smaller than ibs or obs. EXAMPLES
To read an EBCDIC tape blocked ten 80-byte EBCDIC card images per record into the ASCII file x, enter: dd if=/dev/tape/tape0_d0 of=x ibs=800 cbs=80 conv=ascii,lcase Note the use of raw magnetic tape. The dd command is especially suited to I/O on the raw physical devices because it allows reading and writing in arbitrary record sizes. To convert an ASCII text file to EBCDIC, enter: dd if=text.ascii of=text.ebcdic conv=ebcdic This converts text.ascii to EBCDIC representation, storing this in text.ebcdic. ENVIRONMENT VARIABLES
The following environment variables affect the execution of dd: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for- mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: cp(1), cpio(1), sed(1), tar(1), tr(1), trbsd(1) Functions: lseek(2) Routines: fseek(3) Files: ascii(5) Standards: standards(5) Command and Shell User's Guide AdvFS Administration dd(1)
All times are GMT -4. The time now is 09:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy