- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- stripping a non printable character from only last...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2002 11:49 AM
тАО02-22-2002 11:49 AM
"var1","var2","var3"$
"var1","var2","var3"$
"var1","var2","var3"$
"var1","var2","var3"$
I can see the $ in vi when I use the command
:set list
I want to strip off the $ from the last row only. I want the above example to look like this;
"var1","var2","var3"$
"var1","var2","var3"$
"var1","var2","var3"$
"var1","var2","var3"
Does anyone know how to do this?
Solved! Go to Solution.
- Tags:
- unprintable chars
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2002 11:52 AM
тАО02-22-2002 11:52 AM
Re: stripping a non printable character from only last row of data only
That's quite funny. You did a ":set list" which displays all control characters as extended characters, like ^F for ctrl-F and the $ (dollar sign) shows you where the end of the line is. The $ is not in the file.
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2002 12:25 PM
тАО02-22-2002 12:25 PM
Re: stripping a non printable character from only last row of data only
Set list uses $ to show the end of the line. It is not a part of the data.
Use od to see what's actually in the file.
I presume this is in relation to your earlier post about loading a file into SQL Server. How about posting the results of:
tail -2 file | od -cb
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2002 01:05 PM
тАО02-22-2002 01:05 PM
Re: stripping a non printable character from only last row of data only
tail -1 file | od -cb
Here is the last section of the output;
" S E N I O
042 123 105 116 111 117
R C O N S U L T A N T " , " 0
122 040 103 117 116 123 125 114 124 101 116 124 042 054 042 060
3 0 8 7 " , " 0 " \n
060 070 067 042 054 042 060 042 012
Thanks for you help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2002 01:33 PM
тАО02-22-2002 01:33 PM
Re: stripping a non printable character from only last row of data only
The last line of your file is:
"SENIORCONSULTANT","03087","0"
There is no $ at the end of the line. The only "unprintable" character is the newline (\n or octal 012) which delimits every line in a text file.
Your od output also shows there is no blank line at the end of the file.
Do you still have a problem with this file if you ftp it to Windows in ascii mode?
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2002 03:04 PM
тАО02-25-2002 03:04 PM
Re: stripping a non printable character from only last row of data only
I would want my od output to look like;
"var1","var2","var3"\n
"var1","var2","var3"\n
"var1","var2","var3"\n
"var1","var2","var3"
Any suggestions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2002 03:13 PM
тАО02-25-2002 03:13 PM
SolutionI made a suggestion in your other post:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xe57b50011d20d6118ff40090279cd0f9,00.html
It's not elegant but here it is again:
This is an ugly little script but it should work for you. At least it did on my test file of ~500 lines. The result is all lines print as is except the last which has the newline striped off.
while read line
do
echo "$line\c"
while read line
do
echo "\n$line\c"
done
done
I'm sure there are better ways but...
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2002 07:59 PM
тАО02-25-2002 07:59 PM
Re: stripping a non printable character from only last row of data only
sed '$d' sourcefile > tmpfile
tail -1 sourcefile | tr -d \\012 >> tmpfile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2002 11:09 AM
тАО02-26-2002 11:09 AM