why convert 8 space to 1 tab character on unix?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting why convert 8 space to 1 tab character on unix?
# 1  
Old 08-19-2008
why convert 8 space to 1 tab character on unix?

Hi everybody,

I'm using Hp unix tru64.
I have generate one file from shell script.
bus that file content pre "8 space char" convert one tab character.

why?

result file hex format:
hex 20 20 20 20 20 to 09
# 2  
Old 08-19-2008
i need CR/FL format file on unix.
# 3  
Old 08-19-2008
How does the script look like and why do you need a dos/windows format in Unix?

Regards
# 4  
Old 08-19-2008
1. file1.sql content:
SELECT LPAD('1234567890',50,' ')||text result
FROM table1

2. file2.sh content:
sqlplus -s user/pass@db @/disk1/exe/file1.sql >result.txt

I execute file2.sh that generate result.txt file.
The result file all lines should be include before 40 space.
but didn't include 40 space char result file.
Only 5 tab char included in result file.

Last edited by Tlg13team; 08-19-2008 at 05:53 AM.. Reason: script mistake
# 5  
Old 08-19-2008
Are you trying to replace a tab char with 8 spaces in result.txt?

Code:
sed 's/\t/        /g' result.txt

If your sed version don't recognize the "\t" as a tab character you can type Ctrl-V and then a tab instead.
Redirect the output if you want the output in a file.

Regards
# 6  
Old 08-19-2008
Ok(include 40 spaces) file hex format:
00000000h: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ;
00000010h: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ;
00000020h: 20 20 20 20 20 20 20 20 31 32 33 34 35 36 37 38 ; 12345678
00000030h: 39 30 0A ; 90.


My generated wrong format file(include 5 tab). hex format:
00000000h: 09 09 09 09 09 31 32 33 34 35 36 37 38 39 30 0D ; .....1234567890.
00000010h: 0A ; .


why converte just save to file that 20 20 20 20 20 characters to 09 chararcher on the Unix ?

Last edited by Tlg13team; 08-19-2008 at 07:41 AM.. Reason: syntax mistake
# 7  
Old 08-20-2008
thank you

this is working: sed 's/\t/ /g' result.txt > Okfile.txt

Last edited by Tlg13team; 08-20-2008 at 12:07 AM.. Reason: add text
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to convert \n character to newline in UNIX.

I have a variable like below: str1="10.9.11.128\n-rwxr-xr-x user1 2019-12-29 17:53 /var/branch/custom/tg.xml 286030210\n10.9.12.129\n-rwxr-xr-x user1 2019-12-29 17:53 /app/branch/custom/tg.xml 286030210\n10.9.20.130\n-rwxr-xr-x user1 2019-12-29 17:53 /web/branch/custom/tg.xml 286030210" I... (8 Replies)
Discussion started by: mohtashims
8 Replies

2. Shell Programming and Scripting

Convert excel to tab

Hello, I have an excel sheet (.xlsx), with 11 worksheets. I need to run my bash scripts on the 1st worksheet and write the output to the 2nd worksheet. I am currently manually converting the worksheet into a tab delimited to run the script and then pasting it back to excel. Is there a way to do... (2 Replies)
Discussion started by: nans
2 Replies

3. UNIX for Beginners Questions & Answers

How do I remove leading spaces in UNIX when count of space character is not fixed? Example below-

Script showStreamsGLIS$reg.$env.ksh gives me output as below- Job Stime Etime Status ExitCode GLIS-AS-S-EFL-LOCK-B ----- ----- OI 103313880/0 GLIS-ALL-Q-EOD-FX-UPDT-1730-B ----- ----- TE 0/0 GLIS-TK-S-BWSOD-B ... (8 Replies)
Discussion started by: Tanu
8 Replies

4. UNIX for Beginners Questions & Answers

Convert ascii character values to number that comes between the numbers in UNIX

I have variable that contains multiple values of number and also include overpunch(i.e. # $ % etc) character so we want to replace it with numbers. here are the example: Code: 11500#.0# 28575$.5$ 527#.7# 42".2" 2794 .4 2279!.9! 1067&.7& 926#.6# 2279!.9! 885".5" 11714$.4$ 27361'.1'... (1 Reply)
Discussion started by: nadeemrafikhan
1 Replies

5. Shell Programming and Scripting

How to convert space&tab delimited file to CSV?

Hello, I have a text file with space and tab (mixed) delimited file and need to convert into CSV. # cat test.txt /dev/rmt/tsmmt32 HP Ultrium 6-SCSI J3LZ 50:03:08:c0:02:72:c0:b5 F00272C0B5 0/0/6/1/1.145.17.255.0.0.0 /dev/rmt/c102t0d0BEST /dev/rmt/tsmmt37 ... (6 Replies)
Discussion started by: prvnrk
6 Replies

6. UNIX for Dummies Questions & Answers

Changing only the first space to a tab in a space delimited text file

Hi, I have a space delimited text file but I only want to change the first space to a tab and keep the rest of the spaces intact. How do I go about doing that? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies

7. Shell Programming and Scripting

Remove new line character and add space to convert into fixed width file

I have a file with different record length. The file as to be converted into fixed length by appending spaces at the end of record. The length should be calculated based on the record with maximum length in the file. If the length is less than the max length, the spaces should be appended... (4 Replies)
Discussion started by: Amrutha24
4 Replies

8. Shell Programming and Scripting

Convert MS Excel file to Tab limiter file in UNIX

Hi, We have a couple of ms excel files in unix server.We need convert the excel files to files TAB limiter format file with using unix script. Could you please advise on this (2 Replies)
Discussion started by: koti_rama
2 Replies

9. Shell Programming and Scripting

convert new line to tab

hey i m newbie i dont know whether this is happining in my terminal or is there any reason behind this here it is when i do 1.) sed -n 's/\t/\n/gp' space > enter #where space is tab seperated file it works fine it give me a outupt that all tab seperated convert into column but when i... (3 Replies)
Discussion started by: narang.mohit
3 Replies

10. UNIX for Advanced & Expert Users

newline character, space and tab after a string

no problem (6 Replies)
Discussion started by: angelina
6 Replies
Login or Register to Ask a Question