08-30-2010
Editting each line in a file
Hi
Can anyone please help me in resolving my issue.
I have a file with entries like this
t9787ms 99970 22/08/2010 12:30 /www.google.com
t9788ms 99942 22/08/2010 12:40 /www.google.com
t4788ms 88942 22/08/2010 01:40 /www.google.com
there are around 5 lakh records of this type my requirement is to change the file to
<tid>t9787ms</tid> <dlr>99970</dlr> <dat>22/08/2010</dat> <tim>12:30</tim> <url>/www.google.com</url>
all the entries needs to be changed in this way .
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I have several handreds of text files. The format of file looks like:
column1 column2 column3 column4 column5
id1 definition1 name1 fieldid comm1
id2 definition2 name2 fieldid ... (4 Replies)
Discussion started by: ssshen
4 Replies
2. Shell Programming and Scripting
ok, are there any other file editting commands out there other than the below that comes with sunsolaris & linux
vi, emacs, ed, (1 Reply)
Discussion started by: Terrible
1 Replies
3. Shell Programming and Scripting
Hi,
I am having sequence of process ids in one file.
My file contents is (Output of fuser someobject.so).
654 14583 17890 25902
This no. of processes may vary depends up on the object.
I want to check all the processes one by one. If i want to apply egrep, I need to... (3 Replies)
Discussion started by: sharif
3 Replies
4. UNIX for Dummies Questions & Answers
I have two files. One has:
ID# 0 a b c d e f g h i j k....................~2 milion columns
ID# 0 l m n o p q r s t u v....................~2 milion columns
.
.
.
~6000 lines
Other has:
ID# 1
or
ID# 2
.
.
~6000 lines (2 Replies)
Discussion started by: polly_falconer
2 Replies
5. Shell Programming and Scripting
So, I want to read line-by-line a text file with unknown number of files....
So:
a=1
b=1
while ; do
b=`sed -n '$ap' test`
a=`expr $a + 1`
$here do something with b etc
done
the problem is that sed does not seem to recognise the $a, even when trying
sed -n ' $a p'
So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies
6. Shell Programming and Scripting
Hi,
i have file which contains data as below(Only sample shown, it may contain more data similar to the one shown here)
i need to read this file line by line and generate an output file like the one below
i.e based on N value the number of MSISDNs will vary, if N=1 then the following... (14 Replies)
Discussion started by: aemunathan
14 Replies
7. Linux
Hi
I have to replace a pattern found in the first uncommented line in a file. The challenge I'm facing is there are several such similar lines but I have to edit only the first uncommented line.
Eg:
#this is example
#/root/xyz:Old_Pattern
/root/xyz:Old_Pattern
/root/xyz:Old_Pattern
... (10 Replies)
Discussion started by: Stoner008
10 Replies
8. Shell Programming and Scripting
robert (6 Replies)
Discussion started by: robert89
6 Replies
9. Shell Programming and Scripting
Hello,
I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be:
SRVXPAPI001 ERRO JUN24 07:28:34 1775
REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F
... (8 Replies)
Discussion started by: Ferocci
8 Replies
10. Shell Programming and Scripting
Hi all,
I have a log file say Test.log that gets updated continuously and it has data in pipe separated format. A sample log file would look like:
<date1>|<data1>|<url1>|<result1>
<date2>|<data2>|<url2>|<result2>
<date3>|<data3>|<url3>|<result3>
<date4>|<data4>|<url4>|<result4>
What I... (3 Replies)
Discussion started by: pat_pramod
3 Replies
LEARN ABOUT DEBIAN
ne_addr_error
NE_ADDR_RESOLVE(3) neon API reference NE_ADDR_RESOLVE(3)
NAME
ne_addr_resolve, ne_addr_result, ne_addr_first, ne_addr_next, ne_addr_error, ne_addr_destroy - functions to resolve hostnames to addresses
SYNOPSIS
#include <ne_socket.h>
ne_sock_addr *ne_addr_resolve(const char *hostname, int flags);
int ne_addr_result(const ne_sock_addr *addr);
const ne_inet_addr *ne_addr_first(ne_sock_addr *addr);
const ne_inet_addr *ne_addr_next(ne_sock_addr *addr);
char *ne_addr_error(const ne_sock_addr *addr, char *buffer, size_t bufsiz);
void ne_addr_destroy(ne_sock_addr *addr);
DESCRIPTION
The ne_addr_resolve function resolves the given hostname, returning an ne_sock_addr object representing the address (or addresses)
associated with the hostname. The flags parameter is currently unused, and must be passed as 0.
The hostname passed to ne_addr_resolve can be a DNS hostname (e.g. "www.example.com") or an IPv4 dotted quad (e.g. "192.0.34.72"); or, on
systems which support IPv6, an IPv6 hex address, which may be enclosed in brackets, e.g. "[::1]".
To determine whether the hostname was successfully resolved, the ne_addr_result function is used, which returns non-zero if an error
occurred. If an error did occur, the ne_addr_error function can be used, which will copy the error string into a given buffer (of size
bufsiz).
The functions ne_addr_first and ne_addr_next are used to retrieve the Internet addresses associated with an address object which has been
successfully resolved. ne_addr_first returns the first address; ne_addr_next returns the next address after the most recent call to
ne_addr_next or ne_addr_first, or NULL if there are no more addresses. The ne_inet_addr pointer returned by these functions can be passed
to ne_sock_connect to connect a socket.
After the address object has been used, it should be destroyed using ne_addr_destroy.
RETURN VALUE
ne_addr_resolve returns a pointer to an address object, and never NULL. ne_addr_error returns the buffer parameter .
EXAMPLES
The code below prints out the set of addresses associated with the hostname www.google.com.
ne_sock_addr *addr;
char buf[256];
addr = ne_addr_resolve("www.google.com", 0);
if (ne_addr_result(addr)) {
printf("Could not resolve www.google.com: %s
",
ne_addr_error(addr, buf, sizeof buf));
} else {
const ne_inet_addr *ia;
printf("www.google.com:");
for (ia = ne_addr_first(addr); ia != NULL; ia = ne_addr_next(addr)) {
printf(" %s", ne_iaddr_print(ia, buf, sizeof buf));
}
putchar('
');
}
ne_addr_destroy(addr);
SEE ALSO
ne_iaddr_print
AUTHOR
Joe Orton <neon@lists.manyfish.co.uk>
Author.
COPYRIGHT
neon 0.29.6 3 May 2011 NE_ADDR_RESOLVE(3)