LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-18-2004, 02:18 AM   #16
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239

I really can't see why this doesn't work.
It works perfectly for me,

This is silly. There is obviously something going on.
OK, try converting the TABS to something like, the 'pipe' character

Code:
echo $var | tr '\t'  '|'                              #    \t  works for 'tr' in quotes
cat file.blah  | tr  '\t'  '|' > new.file        #  or the whole input file ?
can you not 'head' the input file and post it?
and the script if it's not too big?


billy
 
Old 03-18-2004, 02:36 AM   #17
philipina
Member
 
Registered: May 2003
Posts: 77

Original Poster
Rep: Reputation: 15
the echo $var | tr '\t' '|' is also not working, but again if I replace '\t' by A the replacement is OK. I can can image that there is not Tab in my file but I cannot understand why I can see Hex09 with visual C++ and tabs with Kwrite.

Anyway, here is the output for the command : sed -n '1p'myFile.sql | od -b

0000000 164 162 141 156 163 141 143 164 151 157 156 137 151 144 011 144
0000020 141 164 145 137 162 145 143 157 162 144 011 154 157 143 141 164
0000040 151 157 156 137 151 144 011 164 162 141 156 163 137 164 171 160
0000060 145 011 164 162 141 156 163 137 144 141 164 145 011 164 162 141
0000100 156 163 137 141 155 157 165 156 164 011 164 162 141 156 163 137
0000120 162 145 146 137 156 165 155 011 164 162 141 156 163 137 143 165
0000140 162 162 145 156 143 171 137 151 144 011 143 141 162 144 137 164
0000160 171 160 145 137 151 144 011 143 141 162 144 137 144 141 164 141
0000200 137 151 156 160 165 164 137 155 157 144 145 011 143 141 162 144
0000220 137 156 165 155 142 145 162 011 143 141 162 144 137 145 170 160
0000240 137 144 141 164 145 011 143 141 162 144 137 163 145 162 166 151
0000260 143 145 137 143 157 144 145 011 143 141 162 144 137 164 162 141
0000300 143 153 062 137 162 145 155 141 151 156 144 145 162 011 143 141
0000320 162 144 137 151 163 163 165 145 137 156 165 155 142 145 162 011
0000340 143 141 162 144 137 160 162 145 163 145 156 164 011 143 141 162
0000360 144 150 157 154 144 145 162 137 160 162 145 163 145 156 164 011
0000400 143 141 162 144 150 157 154 144 145 162 137 141 165 164 150 137
0000420 155 145 164 150 157 144 011 143 141 162 144 150 157 154 144 145
0000440 162 137 141 165 164 150 137 145 156 164 151 164 171 011 155 145
0000460 162 143 150 141 156 164 137 143 141 162 144 137 151 144 011 142
0000500 141 156 153 137 155 145 162 143 150 141 156 164 137 151 144 011
0000520 151 156 166 157 151 143 145 137 143 157 155 160 141 156 171 137
0000540 151 144 011 141 165 164 150 137 141 155 157 165 156 164 011 141
0000560 165 164 150 137 144 141 164 145 011 141 165 164 150 137 143 165
0000600 162 162 145 156 143 171 137 151 144 011 141 165 164 150 137 141
0000620 143 164 151 157 156 137 143 157 144 145 011 141 165 164 150 137
0000640 141 160 160 162 157 166 141 154 137 143 157 144 145 011 141 165
0000660 164 150 137 162 145 146 137 156 165 155 011 141 165 164 150 137
0000700 143 157 144 145 137 145 156 164 162 171 137 155 157 144 145 011
0000720 151 163 137 144 143 143 011 144 143 143 137 162 141 164 145 011
0000740 144 143 143 137 141 155 157 165 156 164 011 162 145 146 137 162
0000760 145 161 165 145 163 164 145 162 011 162 145 161 165 145 163 164
0001000 145 162 137 165 163 145 162 137 144 141 164 141 011 162 145 161
0001020 165 145 163 164 145 162 137 166 141 164 137 141 155 157 165 156
0001040 164 011 163 150 151 146 164 137 144 141 164 145 137 157 160 145
0001060 156 011 163 150 151 146 164 137 144 141 164 145 137 143 154 157
0001100 163 145 011 163 150 151 146 164 137 156 165 155 011 151 163 137
0001120 165 160 154 157 141 144 145 144 012
0001131

Thanks again for your help and our patience.

Allan.
 
Old 03-18-2004, 02:40 AM   #18
philipina
Member
 
Registered: May 2003
Posts: 77

Original Poster
Rep: Reputation: 15
If I compare it with what I had with visual C++ it seams like Hex09 is 164!!!

I don't understanf because if I check the output of the command sed -n '1p' myFile.sql | od -b it seams like there are only spec. chars in my file, but this is not the case, this is a "readable" file.

Regards.
 
Old 03-18-2004, 02:43 AM   #19
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
Hey!
Got it!
You need to QUOTE the variable!
hey hey, so easy!

echo "$YourVariable" | cut


regards, billy.
 
Old 03-18-2004, 03:28 AM   #20
philipina
Member
 
Registered: May 2003
Posts: 77

Original Poster
Rep: Reputation: 15
So many thanks.

Thanks, thanks, thanks a lot...

Allan.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C pointers confusion - char ** = char [][] ?? saravkrish Programming 12 12-02-2004 10:06 AM
C Problem---convert char to char* totti10 Programming 11 11-06-2004 11:32 AM
invalid conversion from `char' to `const char* bru Programming 6 05-09-2004 03:07 PM
convert from char* to unsigned char* D J Linux - Software 2 02-20-2004 04:09 AM
Copy a char* to another char* sathyan Programming 8 07-24-2003 06:15 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration