01-08-2009
Thanks guys...
I just stuck to the solution i mentioned....outputting it to a new temporary file...its easier that way.
thanks,
R
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello all:
I have a following textfile data with name inst1.txt
HDR|ABCD|10-13-2008 to 10-19-2008.txt|10-19-2008|XYZ
DTL|H|5464-1|0|02-02-2008|02-03-2008||||F|||||||||
DTL|D|5464-1|1|02-02-2008|02-03-2008|1||JJJ
DTL|D|5464-1|2|02-02-2008|02-03-2008|1||JJJ... (9 Replies)
Discussion started by: ravi0435
9 Replies
2. Shell Programming and Scripting
how to replace the 3rd colum? Each line begins similarly, but they all ends variously.
XX YY 03 variable text here
XX YY 03 more variable text here
XX YY 03 even more variable text here really long setence
XX YY 03 variable numbers also appear 03 11. 123 456
XX YY 03 the occasional comma,... (4 Replies)
Discussion started by: ajp7701
4 Replies
3. Shell Programming and Scripting
Hi All,
I have space delimited file similar to the one as shown below.. I need to convert it as a pipe delimited, the values inside the pipe delimited file should be as highlighted...
AA ATIU2345098809 009697 005374
BB ATIU2345097809 005445 006518
CC ATIU9685098809 003215 003571
DD... (7 Replies)
Discussion started by: nithins007
7 Replies
4. Shell Programming and Scripting
this is Korn shell unix.
The scenario is I have a pipe delimited text file which needs to be customized. say for example,I have a pipe delimited text file with 15 columns(| delimited) and 200 rows. currently the 11th and 12th column has null values for all the records(there are other null columns... (4 Replies)
Discussion started by: vasan2815
4 Replies
5. UNIX for Dummies Questions & Answers
i need to add a new field in a pipe delimited line. the field will be the current date today.
aa|a|s|w|1
as|oiy|oiy|oiy|2
given that all lines are uniformed in the number of fields
i want it to look like this:\
aa|a|s|w|1|20120126
as|oiy|oiy|oiy|2|20120126
please help :) (3 Replies)
Discussion started by: kokoro
3 Replies
6. Shell Programming and Scripting
I have a file which was pipe delimited, I need to make it tab delimited. I tried with sed but no use
cat file | sed 's/|//t/g'
The above command substituted "/t" not tab in the place of pipe.
Sample file:
abc|123|2012-01-30|2012-04-28|xyz
have to convert to:
abc 123... (6 Replies)
Discussion started by: karumudi7
6 Replies
7. Shell Programming and Scripting
Hello All,
Thanks for taking time to read through the thread and for providing any possible solution.
I am trying to pivot a comma separated field in a pipe delimited file. Data looks something like this:
Field1|Field2
123|345,567,789
234|563,560
345|975,098,985,397,984
456|736
Desired... (8 Replies)
Discussion started by: svks1985
8 Replies
8. Shell Programming and Scripting
Hi,
I have a pipe delimited file as below and I need to replace the 2nd column of each line with null values.
1|10/15/2011|fname1|lname1
2|10/15/2012|fname2|lname2
3|10/15/2013|fname3|lname3
Output file:
1||fname1|lname1
2||fname2|lname2
3||fname3|lname3
I tried this
... (2 Replies)
Discussion started by: member2014
2 Replies
9. UNIX for Dummies Questions & Answers
Hi, I have a rquirement in unix as below .
I have a text file with me seperated by | symbol and i need to generate a excel file through unix commands/script so that each value will go to each column.
ex:
Input Text file:
1|A|apple
2|B|bottle
excel file to be generated as output as... (9 Replies)
Discussion started by: raja kakitapall
9 Replies
10. Shell Programming and Scripting
I am trying to parse the input in awk to include the |gc= in $4 but am not able to. The below is close:
awk so far:
awk '{sub(/\|]+]++/, ""); print }' input.txt Input
chr1 955543 955763 AGRN-6|pr=2|gc=75 0 +
chr1 957571 957852 AGRN-7|pr=3|gc=61.2 0 +
chr1 970621 ... (7 Replies)
Discussion started by: cmccabe
7 Replies
tmpnam(3S) tmpnam(3S)
NAME
tmpnam(), tempnam() - create a name for a temporary file
SYNOPSIS
DESCRIPTION
and generate file names that can safely be used for a temporary file.
Always generates a file name using the path-prefix defined as
in the header file. If s is NULL, leaves its result in an internal static area and returns a pointer to that area.
The next call to destroys the contents of the area. If s is not NULL, it is assumed to be the address of an array of
at least bytes, where is a constant defined in places its result in that array and returns s. For multi-thread
applications, if s is a NULL pointer, the operation is not performed and a NULL pointer is returned.
allows the user to control the choice of a directory.
The argument dir points to the name of the directory in which the file is to be created. If dir is NULL or points to
a string that is not an appropriate directory name, the path-prefix defined as in the header file is used. If that
directory is not accessible, is used as a last resort. This entire sequence can be up-staged by providing an envi-
ronment variable in the user's environment, whose value is the name of the desired temporary-file directory.
In order to request the default behavior for either or a NULL value must be passed in dir and pfx for or in s for If valid parameters are
not passed in, behavior is undefined.
Many applications are written such that temporary files have certain initial character sequences in their names. Use the pfx argument to
define a given prefix. The argument can be NULL or point to a string of up to five characters to be used as the first characters in the
temporary-file name.
uses (see malloc(3C)) to get space for the constructed file name, and returns a pointer to this area. Thus, any pointer value returned
from can serve as an argument to (see malloc(3C)). If cannot return the expected result for any reason; i.e., failed, or none of the above
mentioned attempts to find an appropriate directory was successful, a NULL pointer is returned.
Notes
and generate a different file name each time they are called, but start recycling previously used names if called more than times in a sin-
gle process.
Files created using these functions and either or (see fopen(3S) and creat(2)) are temporary only in the sense that they reside in a direc-
tory intended for temporary use, and their names are unique. It is the user's responsibility to use unlink(2) to remove the file when it
is no longer needed.
WARNINGS
Between the time a file name is created and the file is opened, it is possible for some other process to create a file with the same name.
This can never happen if that other process is using these functions or and the file names are chosen such that duplication by other means
is unlikely.
SEE ALSO
creat(2), unlink(2), malloc(3C), mktemp(3C), fopen(3S), tmpfile(3S), thread_safety(5).
STANDARDS CONFORMANCE
tmpnam(3S)