How to write the file by position


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to write the file by position
Prev   Next
# 2  
Old 05-03-2009
save the file as comma seperated csv and then the fields should be comma seperated. import the file into the unix box and then run
Code:
awk -F "," '{for(i=1;i<=NF;i++)printf("%s",$i);printf "\n"}' OFS="|" filenaME

change OFS to any character you like in the above command line



cheers,
Devaraj Takhellambam
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Inserting value at a particular position without changing the position of other characters

Hi All, I wanted a sed/awk command to add a value/character on a particular position without disturbing the position of other characters. I have file a.txt OL 10031 Day Black Midi Good Value P01 P07 OL 10031 Day Black Short Good Value P01 P07 I want to get the output as... (2 Replies)
Discussion started by: rahulsk
2 Replies

2. Shell Programming and Scripting

Search for a string at a particular position and replace with blank based on position

Hi, I have a file with multiple lines(fixed width dat file). I want to search for '02' in the positions 45-46 and if available, in that lines, I need to replace value in position 359 with blank. As I am new to unix, I am not able to figure out how to do this. Can you please help me to achieve... (9 Replies)
Discussion started by: Pradhikshan
9 Replies

3. Shell Programming and Scripting

Need command or script to print all lines from 2nd position to last but one position

hi guys, i want command or script to display the content of file from 2nd position to last but one position of a file abcdefghdasdasdsd 123,345,678,345,323 434,656,656,656,656 678,878,878,989,545 4565656667,65656 i want to display the same above file without first and... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies

4. Shell Programming and Scripting

Write a word at 72nd position of a matched line in a file

Hi, I need to search a file for a pattern,replace some other word and write a word at its 72nd position. For example, My name is Mano.Im learning Unix. I want to search the file in all lines containing the word "Mano".In that matched line,replace the word "Unix" with "Java".And... (5 Replies)
Discussion started by: mano1 n
5 Replies

5. Shell Programming and Scripting

Remove text from n position to n position sed/awk

I want to remove text from nth position to nth position couple of times in same line my line is "hello is there anyone can help me with this question" I need like this ello is there anyone can help me with question 'h' is removed and 'this' removed from the line. I want to do this... (5 Replies)
Discussion started by: elamurugu
5 Replies

6. Shell Programming and Scripting

Moving first position in a file to the last position

hi, I have a file which consists of some records: 2010_06_4010093_001_001|10|ABCDEFGH|9|4010093||0040400||31.12.2009|S|O|X||||20100602093851-31.12.2009|XXBBFC|EFG||||00001| 2010_06_4010162_001_001|11|ABCDEFGH|9|4010162||0040400||31.12.2009|S|O|X||||20100602093851-31.12.2009|XXBBFC|EFG||||00002|... (11 Replies)
Discussion started by: pparthiv
11 Replies

7. UNIX for Dummies Questions & Answers

Grep in a file for a particular pattern in a particular position witihn the file

Assume I have a file with a lot of data sets like 123 abc 01 456 def 02 789 ghi and I only want to grep all that datasets from my file having the pattern '02' at the postion 9-10 to get only 456 def 02 So I could group the datsets into three files according to the position 9-10, one... (9 Replies)
Discussion started by: ABE2202
9 Replies

8. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

9. UNIX for Dummies Questions & Answers

find if a position is between a given start and end position

Hi, I am a newbie in unix programming so maybe this is a simple question. I would like to know how can I make a script that outputs only the values that are not between any given start and end positions Example file1: 2 30 40 80 82 100 file2: ID1 1 ID2 35 ID3 80 ID4 81 ID6... (9 Replies)
Discussion started by: fadista
9 Replies

10. Shell Programming and Scripting

how to find a position and print some string in the next and same position

I need a script for... how to find a position of column data and print some string in the next line and same position position should find based on *HEADER8* in text for ex: ord123 abs 123 987HEADER89 test234 ord124 abc 124 987HEADER88 test235 ... (1 Reply)
Discussion started by: naveenkcl
1 Replies
Login or Register to Ask a Question
ldns(3) 						     Library Functions Manual							   ldns(3)

NAME
ldns_buffer_write_at, ldns_buffer_write_at, ldns_buffer_write, ldns_buffer_write_string_at, ldns_buffer_write_string, ldns_buf- fer_write_u8_at, ldns_buffer_write_u8, ldns_buffer_write_u16_at, ldns_buffer_write_u16, ldns_buffer_read_at, ldns_buffer_read, ldns_buf- fer_read_u8_at, ldns_buffer_read_u8, ldns_buffer_read_u16_at, ldns_buffer_read_u16, ldns_buffer_read_u32_at, ldns_buffer_read_u32 SYNOPSIS
#include <stdint.h> #include <stdbool.h> #include <ldns/ldns.h> void ldns_buffer_write_at(ldns_buffer *buffer, size_t at, const void *data, size_t count); void ldns_buffer_write_at(ldns_buffer *buffer, size_t at, const void *data, size_t count); void ldns_buffer_write(ldns_buffer *buffer, const void *data, size_t count); void ldns_buffer_write_string_at(ldns_buffer *buffer, size_t at, const char *str); void ldns_buffer_write_string(ldns_buffer *buffer, const char *str); void ldns_buffer_write_u8_at(ldns_buffer *buffer, size_t at, uint8_t data); void ldns_buffer_write_u8(ldns_buffer *buffer, uint8_t data); void ldns_buffer_write_u16_at(ldns_buffer *buffer, size_t at, uint16_t data); void ldns_buffer_write_u16(ldns_buffer *buffer, uint16_t data); void ldns_buffer_read_at(ldns_buffer *buffer, size_t at, void *data, size_t count); void ldns_buffer_read(ldns_buffer *buffer, void *data, size_t count); uint8_t ldns_buffer_read_u8_at(ldns_buffer *buffer, size_t at); uint8_t ldns_buffer_read_u8(ldns_buffer *buffer); uint16_t ldns_buffer_read_u16_at(ldns_buffer *buffer, size_t at); uint16_t ldns_buffer_read_u16(ldns_buffer *buffer); uint32_t ldns_buffer_read_u32_at(ldns_buffer *buffer, size_t at); uint32_t ldns_buffer_read_u32(ldns_buffer *buffer); DESCRIPTION
ldns_buffer_write_at() writes the given data to the buffer at the specified position buffer: the buffer at: the position (in number of bytes) to write the data at data: pointer to the data to write to the buffer count: the number of bytes of data to write ldns_buffer_write_at() writes the given data to the buffer at the specified position buffer: the buffer at: the position (in number of bytes) to write the data at data: pointer to the data to write to the buffer count: the number of bytes of data to write ldns_buffer_write() writes count bytes of data to the current position of the buffer buffer: the buffer data: the data to write count: the lenght of the data to write ldns_buffer_write_string_at() copies the given (null-delimited) string to the specified position at the buffer buffer: the buffer at: the position in the buffer str: the string to write ldns_buffer_write_string() copies the given (null-delimited) string to the current position at the buffer buffer: the buffer str: the string to write ldns_buffer_write_u8_at() writes the given byte of data at the given position in the buffer buffer: the buffer at: the position in the buffer data: the 8 bits to write ldns_buffer_write_u8() writes the given byte of data at the current position in the buffer buffer: the buffer data: the 8 bits to write ldns_buffer_write_u16_at() writes the given 2 byte integer at the given position in the buffer buffer: the buffer at: the position in the buffer data: the 16 bits to write ldns_buffer_write_u16() writes the given 2 byte integer at the current position in the buffer buffer: the buffer data: the 16 bits to write ldns_buffer_read_at() copies count bytes of data at the given position to the given data-array buffer: the buffer at: the position in the buffer to start data: buffer to copy to count: the length of the data to copy ldns_buffer_read() copies count bytes of data at the current position to the given data-array buffer: the buffer data: buffer to copy to count: the length of the data to copy ldns_buffer_read_u8_at() returns the byte value at the given position in the buffer buffer: the buffer at: the position in the buffer Returns 1 byte integer ldns_buffer_read_u8() returns the byte value at the current position in the buffer buffer: the buffer Returns 1 byte integer ldns_buffer_read_u16_at() returns the 2-byte integer value at the given position in the buffer buffer: the buffer at: position in the buffer Returns 2 byte integer ldns_buffer_read_u16() returns the 2-byte integer value at the current position in the buffer buffer: the buffer Returns 2 byte integer ldns_buffer_read_u32_at() returns the 4-byte integer value at the given position in the buffer buffer: the buffer at: position in the buffer Returns 4 byte integer ldns_buffer_read_u32() returns the 4-byte integer value at the current position in the buffer buffer: the buffer Returns 4 byte integer AUTHOR
The ldns team at NLnet Labs. Which consists out of Jelte Jansen and Miek Gieben. REPORTING BUGS
Please report bugs to ldns-team@nlnetlabs.nl or in our bugzilla at http://www.nlnetlabs.nl/bugs/index.html COPYRIGHT
Copyright (c) 2004 - 2006 NLnet Labs. Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
ldns_buffer. And perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. REMARKS
This manpage was automaticly generated from the ldns source code by use of Doxygen and some perl. 30 May 2006 ldns(3)