I suspect the last line not only has no ^M, but no newline as well. Not just bash read, but many shell utilities such as awk and sed can't be depended on to read a last line which has no ending newline.
Fortunately it's easy enough to add it.
Ok - trying to unscramble this...
- first lines make a temp copy of the input file and put a newline character at the end
- next section loops through the file
I'm not clear on what the line '[ -z "$LINE" ] && continue' does. Is it jumping to the 'done' line, which would skip my processing code?
Hi all,
I have a file with single white space delimited values, I want to convert them to a tab delimited file.
I tried sed, tr ... but nothing is working.
Thanks,
Rajeevan D (16 Replies)
Hi
I am trying to retrieve values from a tab-delimited file.I am using
while read record
value=`echo $record | cut -f12`
done
Where 12 is the column no i want retieve and record is one line of the file.
But it is returning the full record.
Plz help (4 Replies)
Hi Forum
I have a tab delimited file that opens well in Openoffice calc (excel). But when I perform any operation in command line, it reads the file incorrectly. When I 'save As' the same file in office as tab delimited then it works fine.
The file that I think is tab delimited is actually... (8 Replies)
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)
1. The problem statement, all variables and given/known data:
Hello!
I need help with this problem bash shell scripting that basically just reads the data in a tab delimited file and does the following below
1. Read in the data file Survey.txt and assign the column values to variables of... (6 Replies)
Hi How to make tab delimited file to space delimited?
in put file:
ABC kgy
jkh ghj
ash kjl
o/p file:
ABC kgy
jkh ghj
ash kjl
Use code tags, thanks. (1 Reply)
Hi,
I need urgent help with a tab delimited file I am working on.
This is the file :
TTTT|YYYYYYY|jargon-journal|MP0000000UID||"j1, j2, j3"
I need th following output:
TTTT|YYYYYYY|jargon-journal|MP0000000UID||ji
TTTT|YYYYYYY|jargon-journal|MP0000000UID||j2... (8 Replies)
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)
Hello Everyone..
I want to replace the retail col from FileI with cstp1 col from FileP if the strpno matches in both files
FileP.txt
... (2 Replies)
Discussion started by: YogeshG
2 Replies
LEARN ABOUT CENTOS
copymsg
copymsg(9F) Kernel Functions for Drivers copymsg(9F)NAME
copymsg - copy a message
SYNOPSIS
#include <sys/stream.h>
mblk_t *copymsg(mblk_t *mp);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
mp Pointer to the message to be copied.
DESCRIPTION
copymsg() forms a new message by allocating new message blocks, and copying the contents of the message referred to by mp (using the
copyb(9F) function). It returns a pointer to the new message.
RETURN VALUES
If the copy is successful, copymsg() returns a pointer to the new message. Otherwise, it returns a NULL pointer.
CONTEXT
copymsg() can be called from user or interrupt context.
EXAMPLES
Example 1: : Using copymsg
The routine lctouc() converts all the lowercase ASCII characters in the message to uppercase. If the reference count is greater than one
(line 8), then the message is shared, and must be copied before changing the contents of the data buffer. If the call to the copymsg()
function fails (line 9), return NULL (line 10), otherwise, free the original message (line 11). If the reference count was equal to 1, the
message can be modified. For each character (line 16) in each message block (line 15), if it is a lowercase letter, convert it to an upper-
case letter (line 18). A pointer to the converted message is returned (line 21).
1 mblk_t *lctouc(mp)
2 mblk_t *mp;
3 {
4 mblk_t *cmp;
5 mblk_t *tmp;
6 unsigned char *cp;
7
8 if (mp->b_datap->db_ref > 1) {
9 if ((cmp = copymsg(mp)) == NULL)
10 return (NULL);
11 freemsg(mp);
12 } else {
13 cmp = mp;
14 }
15 for (tmp = cmp; tmp; tmp = tmp->b_cont) {
16 for (cp = tmp->b_rptr; cp < tmp->b_wptr; cp++) {
17 if ((*cp <= 'z') && (*cp >= 'a'))
18 *cp -= 0x20;
19 }
20 }
21 return(cmp);
22 }
SEE ALSO allocb(9F), copyb(9F), msgb(9S)
Writing Device Drivers
STREAMS Programming Guide
SunOS 5.10 27 Jun 1995 copymsg(9F)