04-22-2014
Please use code tags as required by forum rule. What so difficult about this?
No, I didn't mean to change FS = "," ; OFS = " " ; in your script; I meant to use my proposal as is.
In your spec you said "... dat file ... (tab separated):" Why then do you set the field separator to ","? No surprise your result is different from mine.
Last edited by RudiC; 04-22-2014 at 02:08 PM..
10 More Discussions You Might Find Interesting
1. Programming
In one of the Unix Programming FAQ's they have the following headers in the program to catch SIGCHLD
#include <sys/types.h> /* include this before any other sys headers */
#include <sys/wait.h> /* header for waitpid() and various macros */
#include <signal.h> /* header for signal... (5 Replies)
Discussion started by: frequency8
5 Replies
2. UNIX for Dummies Questions & Answers
I have the following script:
(echo -n `curl http://www.example.com/scores.txt | grep mylocation`; date +%Y%m%d%H%M%S) >> myscores.txt
This script works fine, except that it places the timestamp at the end of the file myscores.txt. How do add the timestamp as the first column and then a tab and... (4 Replies)
Discussion started by: figaro
4 Replies
3. Shell Programming and Scripting
Hi,
I'm trying to strip all lines between two headers in a file:
### BEGIN ###
Text to remove, contains all kinds of characters
...
Antispyware-Downloadserver.com (Germany)=http://www.antispyware-downloadserver.c
om/updates/
Antispyware-Downloadserver.com #2... (3 Replies)
Discussion started by: Trones
3 Replies
4. Shell Programming and Scripting
Hi ,
I have a typical situation. I have 4 files and with different headers (number of headers is varible ).
I need to make such a merged file which will have headers combined from all files (comman coluns should appear once only).
For example -
File 1
H1|H2|H3|H4
11|12|13|14
21|22|23|23... (1 Reply)
Discussion started by: marut_ashu
1 Replies
5. Shell Programming and Scripting
Hi,
I found the following awk script to transpose multiple (3) columns to multiple rows:
#===
BEGIN {FS=","}
{
for (i=1;i<=NF;i++)
{
arr=$i;
if(nf<= NF)
nf=NF;
}
nr=NR
}
END {
for(i=1;i<=nf;i++)
{ (8 Replies)
Discussion started by: Gery
8 Replies
6. Shell Programming and Scripting
Hi everyone,
Please some help over here. (I´m using cygwing)
I have files with 40 columns and 2000 lines in average. I´m trying to change the order position as follow.
Original columns position:... (3 Replies)
Discussion started by: cgkmal
3 Replies
7. Shell Programming and Scripting
Hi friends,
I have data in tab separated file with headers like this :
*sml1 *sml3 *smln7 smfk9 smllf56...
Which shell command I should use if i want to extract entire columns that have header names beginning with "*" ? i want to copy these columns into another file.
Thanks, (14 Replies)
Discussion started by: jacks
14 Replies
8. Shell Programming and Scripting
I am trying to reorder columns based on a value in a field in the attached file. Thank you :).
If $11 is not equal to "unknown", then in a new text file $4, $11, $7, $13
For example, row 24 $11 is not unknown
A_16_P39089234, chr10:76765556-76765615, KAT6B, 0.9337 (5 Replies)
Discussion started by: cmccabe
5 Replies
9. UNIX for Advanced & Expert Users
Hi. Unix rookie here. Been looking for a few days for reference documents on how BSD UNIX lays the logical file format onto a disk. Goal is to view/edit with hex editor for data repair. Lots of docs are available for how to use Unix commands (like xxd), but I want to learn the map of how Unix... (4 Replies)
Discussion started by: Chris_top_he_r
4 Replies
10. Shell Programming and Scripting
The below awk verifies the count and order of each text file in the directory. The script does execute and produce output, however the order of the headers are not compared to key. The portion in bold is supposed to do that. If the order of the headers in each text file is the same as key, then... (0 Replies)
Discussion started by: cmccabe
0 Replies
LEARN ABOUT DEBIAN
log::agent::tag
Agent::Tag(3pm) User Contributed Perl Documentation Agent::Tag(3pm)
NAME
Log::Agent::Tag - formats caller information
SYNOPSIS
Intended to be inherited from
DESCRIPTION
This class is meant to be inherited by all the classes implementing a log message tag.
A message tag is a little string that is either appended or prepended to all log messages.
For instance, and oversimplifying a bit, a tag meant to be prepended will be inserted in front of the current log message, separated by
separator, which defaults to a single space:
+------------+-----------+---------------------------------+
| tag string | separator | current log message |
+------------+-----------+---------------------------------+
This operation is called tag insertion. The whole string then becomes the current log message, and can be the target of another tag
insertion.
The reality is a little bit more complex, to allow successive tags to be prepended or appended in the order they are specified, and not in
reverse order as they would be if naively implemented. See Log::Agent::Message for the exact semantics of append() and prepend()
operations.
FEATURES
This section documents the interface provided to heirs, in case you wish to implement your own tag class.
_init(name, postfix, separator)
Initialization routine that should be called by all heirs during creation to initialize the common attributes.
postfix
When true, the tag is meant to be appended to the log message. Otherwise, it is prepended.
name
The name of this tag. It is meant to provide by-name access to tags, check whether a given tag is recorded, etc... The names "caller"
and "priority" are architecturally defined to refer to "Log::Agent::Tag::Caller" and "Log::Agent::Tag::Priority" objects.
NOTE: Currently unused by any client code.
separator
The sperating string inserted between the tag and the log message. It defaults to " " if not specified, i.e. left to "undef" when
calling _init().
string()
A deferred routine, to be implemented by heirs.
Returns the tag string only, without the separator, since its exact placement depends on the value of the "postfix" attribute.
insert(message)
Insert this tag withing the "Log::Agent::Message" message, according to the tag specifications (placement, separator). Calls string()
to produce the tag string.
This routine is frozen and should not be redefined by heirs.
STANDARD TAGGING CLASSES
Tagging classes define via their "string()" routine what is the string to be used as a tag. The insertion of the tag within the log
message is done via a frozen routine from the "Log::Agent::Tag" ancestor.
The following classes are provided by "Log::Agent":
"Log::Agent::Tag::Callback"
The "string()" routine invokes a user-supplied callback, given as a "Callback" object. You need the Callback module from CPAN if you
wish to use this class.
"Log::Agent::Tag::Caller"
Used internally to compute the caller and format it according to user specifications.
"Log::Agent::Tag::Priority"
Used internally to format message priorities and add them to the log messages.
"Log::Agent::Tag::String"
Defines a constant tagging string that should be added in all the log messages, e.g. a web session ID.
AUTHOR
Raphael Manfredi <Raphael_Manfredi@pobox.com>
SEE ALSO
Log::Agent::Message(3).
perl v5.10.0 2002-03-09 Agent::Tag(3pm)