Sponsored Content
Full Discussion: Sos Sos
Top Forums Shell Programming and Scripting Sos Sos Post 85352 by Ygor on Tuesday 4th of October 2005 10:03:53 PM
Old 10-04-2005
Try this...
Code:
awk 'BEGIN{FS=" \\| "}
 { printf "insert into XYZ values(\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\");\n",\
           $2, $3, $4, $5, substr($6,7) "-" substr($6, 4,2) "-" substr($6,1,2), $7
 }' file1 > file2

I did test it...
Code:
$ head file[12]
==> file1 <==
USER | User1 | DisplayName1 | HomeTown1 | 987654321 | 27-07-1991 | M

==> file2 <==
insert into XYZ values("User1","DisplayName1","HomeTown1","987654321","1991-07-27","M");

 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

(SOS) Please help !

Does anybody can help me with the definition of "terminal" DTE and DCE in context to Unix ?. This has something to do with devices in Unix. I need it asap. Thank you very much !:confused: (1 Reply)
Discussion started by: aqua_jan
1 Replies

2. UNIX for Dummies Questions & Answers

[sos]How to resure my system.

Yesterday,I have a unnormal shutdown of my SCO Unix system,when I boot again,There are lots of Errors (e.g policy manager error, ifor_pmd error etc.),Most seriously,I can use my "CC" compiler: when I compile my *.c files. Who Can Help Me ! Please Don't spare your instructions! Thanks a... (5 Replies)
Discussion started by: dingxf
5 Replies

3. Shell Programming and Scripting

Sos

Dear "expert", I need to know the command syntax to get the last field of the line below using shell or awk. MD5... (4 Replies)
Discussion started by: Lee Soon Yau
4 Replies

4. Solaris

sun connect :SOS

hi all, does someone have any information about "sun connect" (like documentation , web site , forums , explanations .....) ? because i will need this software in my job & i don't know how to use it :o (4 Replies)
Discussion started by: lid-j-one
4 Replies

5. Shell Programming and Scripting

SOS whit SED

Hello, I know how to get a solution of a filtering problem with AWK, but i need change default field separator by a regular expression. awk -F "xxx" What i want to do is take a stranza as a field, so the field separator must be a EMPTY line. Does anybody how to do that?? a example: ... (1 Reply)
Discussion started by: antuan
1 Replies

6. Solaris

file not found (SOS)

Hi, friends, I am new here and also new in Unix. I want your kindly help for now! I cannot run the program vmed on my computer ,that reply the error $ vmed bash: vmed: command not found $ ./vmed ld.so.1: vmed: fatal: libpgplot.so: open failed: No such file or directory Killed as I... (12 Replies)
Discussion started by: wholesome80
12 Replies

7. HP-UX

sos about swpackage AND swinstall

hi all, I just want to make a depot package.All steps: 1. make a psf file # PSF which define the myutil product depot layout_version 1.0 tag ddmi_linux_installer title ddmi_linux_installer # Product definition vendor tag HP title Hewlett-Packard Company product tag... (0 Replies)
Discussion started by: lb1111830
0 Replies
JOIN(1) 						      General Commands Manual							   JOIN(1)

NAME
join - relational database operator SYNOPSIS
join [-an] [-e s] [-o list] [-tc] file1 file2 DESCRIPTION
Join forms, on the standard output, a join of the two relations specified by the lines of file1 and file2. If file1 is `-', the standard input is used. File1 and file2 must be sorted in increasing ASCII collating sequence on the fields on which they are to be joined, normally the first in each line. There is one line in the output for each pair of lines in file1 and file2 that have identical join fields. The output line normally con- sists of the common field, then the rest of the line from file1, then the rest of the line from file2. Fields are normally separated by blank, tab or newline. In this case, multiple separators count as one, and leading separators are dis- carded. These options are recognized: -an In addition to the normal output, produce a line for each unpairable line in file n, where n is 1 or 2. -e s Replace empty output fields by string s. -o list Each output line comprises the fields specified in list, each element of which has the form n.m, where n is a file number and m is a field number. -tc Use character c as a separator (tab character). Every appearance of c in a line is significant. SEE ALSO
sort(1), comm(1), awk(1). BUGS
With default field separation, the collating sequence is that of sort -b; with -t, the sequence is that of a plain sort. The conventions of join, sort, comm, uniq, look and awk(1) are wildly incongruous. 7th Edition April 29, 1985 JOIN(1)
All times are GMT -4. The time now is 10:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy