03-29-2008
Where would I put the line in the code?
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi
I have a CSV file with me in this format
Currency, USD, EUR,
USD, 1.00, 1.32,
EUR, 0.66, 1.00,
How do I transpose the file to get to the format below.
currency, currency, rate
USD, USD, 1.00
USD, EUR, 1.32
EUR, USD, 0.66
EUR, EUR, 1.00
Thanks for your help
We are using... (2 Replies)
Discussion started by: cdesiks
2 Replies
2. Shell Programming and Scripting
I have a file, not really a csv, but containing delineated data just the same. Lets call that file "raw_data.txt". It contains data in the format of company name:fein number like this:
first company name:123456789
second company name:987654321
what i need to do is read this file, apply... (11 Replies)
Discussion started by: FreddyG
11 Replies
3. Shell Programming and Scripting
Hi,
It's been a few years since college when I did stuff like this all the time. Can someone help me figure out how to best tackle this problem? I need to parse a file full of entries that look like this:
<eq action="A" sectyType="0" symbol="PGR" exch="CA" curr="VEF" sess="NORM"... (7 Replies)
Discussion started by: Pcushing
7 Replies
4. Shell Programming and Scripting
Hi,
Our requirement is to parse the input file(.csv format). The each column in the file is delimited with comma. We need to take each column and apply some business validation rule.
If data itself contains comma, then those fields are enclosed with double quotes ("). We can see this double... (7 Replies)
Discussion started by: vfrg
7 Replies
5. Shell Programming and Scripting
#!/bin/bash
i=0
cat 1.csv | while read fileline
do
echo "$fileline"
IFS="#" flds=( $fileline )
nrofflds=${#flds}
echo "noof fields$nrofflds"
fld=0
while
do
echo "noof counter$fld"
echo "$nrofflds"
#fld1="${flds}" trying to store the content of line to fields but i... (4 Replies)
Discussion started by: barani75
4 Replies
6. Shell Programming and Scripting
Hello Expert,
I have a file in the following format:
SYNTAX_VERSION 5
MONITOR "NAME_TEMPLATES"
DESCRIPTION "Monitors for contents of error "
INTERVAL "1m"
MONPROG "script.sh NAME_TEMPLATES"
MAXTHRESHOLD
GEN_BELOW_RESET
SEVERITY Major
... (17 Replies)
Discussion started by: Ant-one
17 Replies
7. Shell Programming and Scripting
Enclosed is comma separated text file. I need to write a korn shell program that will parse the text file and insert the values into Oracle database.
I need to write the korn shell program on Red Hat Enterprise Linux server.
Oracle database is 10g. (15 Replies)
Discussion started by: shellguy
15 Replies
8. UNIX for Dummies Questions & Answers
Hello !
I am very aware that this is not the first time this question is asked here, because I have already read a lot of previous answers, but none of them worked, so...
As said in the title, I want to read a csv file with a bash script.
Here is a sample of the file:
... (4 Replies)
Discussion started by: Grhyll
4 Replies
9. Shell Programming and Scripting
Consolidate several lines of a CSV file with firewall rules
Hi guys.
I have a CSV file, which I created using an HTML export from a Check Point firewall policy.
Each rule is represented as several lines, in some cases. That occurs when a rule has several address sources, destinations or... (4 Replies)
Discussion started by: starriol
4 Replies
10. Shell Programming and Scripting
My source file looks like this:
Cust-Number = "101"
Cust-Name="Joe"
Cust-Town="London"
Cust-hobby="tennis"
Cust-purchase="200"
Cust-Number = "102"
Cust-Name="Mary"
Cust-Town="Newyork"
Cust-hobby="reading"
Cust-purchase="125"
Now I want to parse this file (leaving out hobby) and... (10 Replies)
Discussion started by: Balav
10 Replies
LEARN ABOUT CENTOS
qreply
qreply(9F) Kernel Functions for Drivers qreply(9F)
NAME
qreply - send a message on a stream in the reverse direction
SYNOPSIS
#include <sys/stream.h>
void qreply(queue_t *q, mblk_t *mp);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
q Pointer to the queue.
mp Pointer to the message to be sent in the opposite direction.
DESCRIPTION
qreply() sends messages in the reverse direction of normal flow. That is, qreply(q, mp) is equivalent to putnext(OTHERQ(q), mp).
CONTEXT
qreply() can be called from user or interrupt context.
EXAMPLES
Example 1: Canonical Flushing Code for STREAMS Drivers.
This example depicts the canonical flushing code for STREAMS drivers. Assume that the driver has service procedures so that there may be
messages on its queues. See srv(9E). Its write-side put procedure handles M_FLUSH messages by first checking the FLUSHW bit in the first
byte of the message, then the write queue is flushed (line 8) and the FLUSHW bit is turned off (line 9). See put(9E). If the
FLUSHR bit is on, then the read queue is flushed (line 12) and the message is sent back up the read side of the stream with the qre-
ply(9F) function (line 13). If the FLUSHR bit is off, then the message is freed (line 15). See the example for flushq(9F) for the canoni-
cal flushing code for modules.
1 xxxwput(q, mp)
2 queue_t *q;
3 mblk_t *mp;
4 {
5 switch(mp->b_datap->db_type) {
6 case M_FLUSH:
7 if (*mp->b_rptr & FLUSHW) {
8 flushq(q, FLUSHALL);
9 *mp->b_rptr &= ~FLUSHW;
10 }
11 if (*mp->b_rptr & FLUSHR) {
12 flushq(RD(q), FLUSHALL);
13 qreply(q, mp);
14 } else {
15 freemsg(mp);
16 }
17 break;
. . .
18 }
19 }
SEE ALSO
put(9E), srv(9E), flushq(9F), OTHERQ(9F), putnext(9F)
Writing Device Drivers
STREAMS Programming Guide
SunOS 5.10 11 Apr 1991 qreply(9F)