Removing hidden tabs

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Removing hidden tabs
# 1  
Old 06-28-2011
Removing hidden tabs

I want to know how can I remove all the tabs (\t) from a tab delimited file. In my file some of the rows only contain one column and rest are unoccupied but the tabs are there. When I performed some regular expressions to do substitutions like:
%s/\t/\/\/ /ig

all the hidden tabs are converted to //, which I don't want. How do I remove this unwanted tabs espeacillay on the rows that have only a single column entry.

# 2  
Old 06-28-2011
tr -d "\t" myfile

# 3  
Old 06-28-2011
I think it didn't work. I think I need to add some options immediately after tr
# 4  
Old 06-28-2011
% cat input_file | tr -s "\t" '/' | sed 's,/$,//,g'

# 5  
Old 06-28-2011
tr -d '\011' <test.txt >out.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rsync - how to copy hidden folder or hidden files when using full path

Hello. I use this command : rsync -av --include=".*" --dry-run "$A_FULL_PATH_S" "$A_FULL_PATH_D"The data comes from the output of a find command. And no full source directories are in use, only some files. Source example... (2 Replies)
Discussion started by: jcdole
2 Replies

2. UNIX for Dummies Questions & Answers

Removing PATTERN from txt without removing lines and general text formatting

Hi Everybody! First post! Totally noobie. I'm using the terminal to read a poorly formatted book. The text file contains, in the middle of paragraphs, hyphenation to split words that are supposed to be on multiple pages. It looks ve -- ry much like this. I was hoping to use grep -v " -- "... (5 Replies)
Discussion started by: AxeHandle
5 Replies

3. UNIX for Dummies Questions & Answers

List all directories hidden or not hidden

I want to list all directories hidden or not hidden. ls -ld */ => shows only not hidden directories so i guess the answer would be to add the a option to show all files ls -lad */ => not working :confused: ls -la | grep "^d" => works But I would like to know why I can't use ls -lad... (4 Replies)
Discussion started by: servus
4 Replies

4. Shell Programming and Scripting

Removing "Hidden Characters" on a file

Hi - I'm having a problem with hidden characters on Linux. When I produced an output from Oracle database, there is a an extra "Hidden Character" included on the output. How can I remove that character? See below: The extra dollar sign is creating a new line on my .csv output file. I... (16 Replies)
Discussion started by: Jin_
16 Replies

5. Shell Programming and Scripting

too many tabs

Hi, I have a file that has too many tabs between columns. I cannot get the tabs out. Basically the tab between column 1 and 2 are fine but between 2/3, 3/4 etc are like 5 tabs. How do I get rid of these 5 tabs so its just 1 tab. thanks (3 Replies)
Discussion started by: phil_heath
3 Replies

6. Shell Programming and Scripting

Finding Hidden files and protecting the folder containing hidden files from deletion

Hi. I have a script which is deleting files with a particular extension and older than 45 days.The code is: find <path> -name "<filename_pattern>" -mtime +45 -exec rm {} \; But the problem is that some important files are also getting deleted.To prevent this I have decide to make a dummy... (4 Replies)
Discussion started by: pochaw
4 Replies

7. UNIX for Dummies Questions & Answers

removing a user with hidden files

Hello, I am trying to remove an employing from our database, I have removed all her files but can't remove the directory because of the hidden files. How do I remove the user? Thanks, (1 Reply)
Discussion started by: nov_user
1 Replies

8. Shell Programming and Scripting

removing certain tabs

I have a tab delimited file with many lines, one for each record. each line is tab delimited with a tab before the first data field, a tab between each data field, and a tab after the last data field before it moves onto the next line. I need to remove only the preceeding tab before the first... (2 Replies)
Discussion started by: djkane
2 Replies

9. Shell Programming and Scripting

removing tabs

Hi Everyone, Im trying to write a shell script that removes a "newline character followed by a tab" throughout a file. basically it should get rid of it. Here's an example File Before The cat sat on the mat File After The cat sat on the mat This message writing screen has... (7 Replies)
Discussion started by: nbvcxzdz
7 Replies
Login or Register to Ask a Question