12-15-2010
The line terminator for text files in a M$ environment is two characters: carriage-return then line-feed.
The line terminator in unix text files is one character: line-feed.
If you copy a text file from M$ to unix without conversion it will contain spurious carriage-return characters which will upset the data format.
Further to DGPickett if you use "ftp" from M$ to unix you must use the "ASCII" option.
If a bit-copy is unavoidable, then use a conversion program such as "dos2ux" (that utility can be called "dos2unix" on some platforms). Personally I use unix "tr" to remove bad characters.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I have a file that has got carriage returns in it and I want to take them out. Anyone know how I can do this in a ksh?
thanks (4 Replies)
Discussion started by: pitstop
4 Replies
2. Shell Programming and Scripting
Hi,
I have a fixed width flat file which has 1 as the first char and E as the last character. Some of the records have a carriage return /line feeds .
how do I remove them?
Let me know.
Thanks
VSK (8 Replies)
Discussion started by: vsk
8 Replies
3. Shell Programming and Scripting
:confused: hi all,
i have csv file with three comma separated columns
i/p file
First_Name, Address, Last_Name
XXX, "456 New albany \n newyork, Unitedstates \n 45322-33", YYY\n
ZZZ, "654 rifle park \n toronto, canada \n 43L-w3b", RRR\n
is there any way i can remove \n (newline) from... (10 Replies)
Discussion started by: gowrish
10 Replies
4. Shell Programming and Scripting
Hi all,
I know this is **awfully** general but.....
I have a script which does, basically...
for file in `find command`; do
some stuff
more stuff
echo '.\c'
done
I want to output the '.' char just to give an idea of progress. However, it works fine for a while and then I... (2 Replies)
Discussion started by: ajcannon
2 Replies
5. Shell Programming and Scripting
Hi gurus
I am stripping lots of email addresses from a file with this
grep "^To" file.log |awk '{print "1,"$2}' > recipients.out
file.log looks something like this:
oasndfoasnosf
To: person@email.co.uk
lsdfjosd
sdlfnmsopdfwer
dtlghodrgn
To: person2@emailsss.com
sldfnsdf
I... (5 Replies)
Discussion started by: terry2009
5 Replies
6. Shell Programming and Scripting
I have some data, each record (line) ends with a line feed (\n). Each field is pipe (|) delimited.
1|short desc|long text|2001-01-01 01:01
2|short desc| long
text |2002-02-02 02:02
3|short desc| long text | 2003-03-03 03:03
4|short desc
| long text | 2004-04-04 04:04
... (10 Replies)
Discussion started by: ericdp63
10 Replies
7. Shell Programming and Scripting
Hi everyone,
I'm very new to using sed, run through some tutorials and everything but I've hit a problem that I'm unable to solve by myself.
I need to remove all linefeeds that are followed by a particular character (in this case a semicolon). So basically, all lines starting with a semicolon... (5 Replies)
Discussion started by: fluffdasheep
5 Replies
8. UNIX for Advanced & Expert Users
Hi,
I have the following file,
ABC.txt:
ABC=123
DEF=234
FGH=345
Based on my validation and conditional processing it is observed that i need to comment or append # before DEF=234
so the same file ABC.txt should look as follows
ABC=123
#DEF=234
FGH=345
Sorry if its a... (6 Replies)
Discussion started by: mihirvora16
6 Replies
9. Shell Programming and Scripting
Hi
$ cat ad.sh
ldapsearorg -x -LLL -h sb1131z.testbadbigcorp.org -D "CN=ADMINZZ,OU=AdminRoles,DC=testbadbigcorp,DC=org" -w "UT3w4f57lll--4...4" -b "OU=Test,DC=testbadbigcorp,DC=org" "(&(&(&(&(objectCategory=person)(objectClass=user)(lockoutTime:1.2.840.113556.1.4.804:=4294967295)))))" dn$... (3 Replies)
Discussion started by: slashdotweenie
3 Replies
10. Shell Programming and Scripting
I would like to remove carriage returns/line feeds in a text file, but in a specific cadence:
Read first line (Header Line 1), remove cr/lf at the end (replace it with a space ideally);
Read the next line (Line of Text 2), leave the cr/lf intact;
Read the next line, remove the cr/lf;
Read... (14 Replies)
Discussion started by: tomr2012
14 Replies
col(1) User Commands col(1)
NAME
col - reverse line-feeds filter
SYNOPSIS
col [-bfpx]
DESCRIPTION
The col utility reads from the standard input and writes to the standard output. It performs the line overlays implied by reverse line-
feeds, and by forward and reverse half-line-feeds. Unless -x is used, all blank characters in the input will be converted to tab charac-
ters wherever possible. col is particularly useful for filtering multi-column output made with the .rt command of nroff(1) and output
resulting from use of the tbl(1) preprocessor.
The ASCII control characters SO and SI are assumed by col to start and end text in an alternative character set. The character set to which
each input character belongs is remembered, and on output SI and SO characters are generated as appropriate to ensure that each character
is written in the correct character set.
On input, the only control characters accepted are space, backspace, tab, carriage-return and newline characters, SI, SO, VT, reverse line-
feed, forward half-line-feed and reverse half-line-feed. The VT character is an alternative form of full reverse line-feed, included for
compatibility with some earlier programs of this type. The only other characters to be copied to the output are those that are printable.
The ASCII codes for the control functions and line-motion sequences mentioned above are as given in the table below. ESC stands for the
ASCII escape character, with the octal code 033; ESC- means a sequence of two characters, ESC followed by the character x.
reverse line-feed ESC-7
reverse half-line-feed ESC-8
forward half-line-feed ESC-9
vertical-tab (VT) 013
start-of-text (SO) 016
end-of-text (SI) 017
OPTIONS
-b Assume that the output device in use is not capable of backspacing. In this case, if two or more characters are to appear in the
same place, only the last one read will be output.
-f Although col accepts half-line motions in its input, it normally does not emit them on output. Instead, text that would appear
between lines is moved to the next lower full-line boundary. This treatment can be suppressed by the -f (fine) option; in this
case, the output from col may contain forward half-line-feeds (ESC-9), but will still never contain either kind of reverse line
motion.
-p Normally, col will ignore any escape sequences unknown to it that are found in its input; the -p option may be used to cause col
to output these sequences as regular characters, subject to overprinting from reverse line motions. The use of this option is
highly discouraged unless the user is fully aware of the textual position of the escape sequences.
-x Prevent col from converting blank characters to tab characters on output wherever possible. Tab stops are considered to be at each
column position n such that n modulo 8 equals 1.
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of col: LC_CTYPE, LC_MESSAGES, and
NLSPATH.
EXIT STATUS
The following error values are returned:
0 Successful completion.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWesu |
+-----------------------------+-----------------------------+
|CSI |enabled |
+-----------------------------+-----------------------------+
SEE ALSO
nroff(1), tbl(1), ascii(5), attributes(5), environ(5)
NOTES
The input format accepted by col matches the output produced by nroff with either the -T37 or -Tlp options. Use -T37 (and the -f option of
col) if the ultimate disposition of the output of col will be a device that can interpret half-line motions, and -Tlp otherwise.
col cannot back up more than 128 lines or handle more than 800 characters per line.
Local vertical motions that would result in backing up over the first line of the document are ignored. As a result, the first line must
not have any superscripts.
SunOS 5.10 1 Feb 1995 col(1)