10-03-2008
Aside: Both of your commands to remove spaces or tabs do not work. This is why you were misled.
Try:
To remove spaces:
tr -d " "
To remove tabs:
TAB=`echo "\0011"`
tr -d "${TAB}"
Notwithstanding "joeyg" good advice. To get a feel for whether white space is spaces or tabs you can substitute them both to make them visible.
TAB=`echo "\0011"`
cat filename|sed -e "s/${TAB}/TAB/g"|sed -e "s/ /SPACE/g"|pg
(Shell purists may cringe at this inefficient pipeline but it is only an example).
In your case the original problem is with using "cut" which requires a fixed delimiter.
If your use "awk" to get the second field it won't matter whether its a space or a tab.
cat filename|awk '{print $2}'
10 More Discussions You Might Find Interesting
1. Solaris
Can anyone help me find and replace blank rows in a file with a numeric value (ie blankrow=someTxtOrNumValue), the file is over 500,000 rows long so it would need to be the quickest way as I'll need to do this for multiple files...I would be greatfull for any suggestions....thanks
sample file:... (2 Replies)
Discussion started by: Gerry405
2 Replies
2. UNIX for Dummies Questions & Answers
Hi,
i have a tab dilimeted file.The records are :header is having column names.I am facing the following issue :
I want to convert the spaces only for header file into "_" in the unix shell but the problem is that if i use sed command all the blank spaces are getting replaced by "_".
For... (3 Replies)
Discussion started by: Amey Joshi
3 Replies
3. Shell Programming and Scripting
hi
i have records in my input file like this
aaa|1234||2bc||rahul|tamilnadu
bba|2234||b4c||bajaj|tamilnadu
what i am expecting is in between two pipes if there is no character it should be replaced with null or 0
so my file will look like this
aaa|1234|null|2bc|0|rahul|tamilnadu... (4 Replies)
Discussion started by: trichyselva
4 Replies
4. Shell Programming and Scripting
Hi,
I have a file origFile.txt with values:
origFile.txt
.00~ 145416.02~ xyz~ ram kishor ~? ~ ~783.9
.35~ 765.76~ anh reid~ kelly woodburg ~nancy ~ ~?
Now each row in the file has value for 7 columns with "~" as delimiter.
The requirement was
i)I need to erase the blank spaces between... (2 Replies)
Discussion started by: badrimohanty
2 Replies
5. Shell Programming and Scripting
Hi Experts,
We are facing some while loading the "csv" file to target table.Some of the records are having values as :
Account number,Name,Address
"123","XYZ","302 Street,Washington,US"
"456","PQR"," 3233 Some Street,
Washington,US"
In the above file instead reading only two records it... (11 Replies)
Discussion started by: Amey Joshi
11 Replies
6. Shell Programming and Scripting
I want my program to replace tabs with spaces.1tab=4spaces.When i write aa(tab)aaa(tab)(tab)a(tab) it must show me aaxxaaaxxxxxaxxx. I think that my program works corectly but when a write aaa(tab)a it must show aaaxa but it is aaaxxxxxa.Please for help!!! That is my code:
#include <stdio.h>
... (3 Replies)
Discussion started by: marto1914
3 Replies
7. Shell Programming and Scripting
Greetings all
I have a delimited text file (the delimiter is ';') where certain fields consist of many blanks e.g. ; ; and ; ;
Before I separate the data I need to eliminate these blanks altogether.
I tried the sed command using the following syntax:
sed -i 's/; *;/;;/g' <filename>
... (15 Replies)
Discussion started by: S. BASU
15 Replies
8. Shell Programming and Scripting
Hello,
I have a file with hundreds of lines. Now I need to replace positions 750-766 in each line (whatever there is there) with spaces... how can I do that?
Which command to use?
The result will be all the lines in the file will have spaces in positions 750-766.
Thanks! (3 Replies)
Discussion started by: netrom
3 Replies
9. Shell Programming and Scripting
Hi I want to read a text file and replace various number of spaces between each string in to a single "," or any other character .Please let me know the command to do so. My input file is a txt file which is the output of a SQL table extract so it contains so many spaces between each column of the... (2 Replies)
Discussion started by: Hari Prasanth
2 Replies
10. UNIX for Beginners Questions & Answers
Could you please advise what is the best way to edit a file without disrupting the spaces?
For example: I have within my file the value below, wherein I wanted to change VALUE2 to VALUETEST.
The total characters on the field of VALUE2 is 15 characters.
VALUE1|VALUE2<9 spaces>|VALUE3
but... (3 Replies)
Discussion started by: asdfghjkl
3 Replies
NPRINT(1) nprint NPRINT(1)
NAME
nprint - NetWare print client
SYNOPSIS
nprint [ -S server ] [ -h ] [ -U username | -n ] [ -C ] [ -q queuename ] [ -d job-description ] [ -p pathname-in-banner ] [ -B username-in-
banner ] [ -s ] [ -f filename-in-banner ] [ -l lines ] [ -r rows ] [ -c copies ] [ -t tab size ] [ -T ] [ -N ] [ -F form-number ] filename
DESCRIPTION
With nprint, you can print files on print queues of a NetWare file server.
There are a lot of options, so you should probably wrap some default configurations into some shell scripts.
nprint looks up the file $HOME/.nwclient to find a file server, a user name and possibly a password. See nwclient(5) for more information.
Please note that the access permissions of .nwclient MUST be 600, for security reasons.
OPTIONS
filename
filename is the name of the file you want to print. If file is '-', or no filename is given, standard input is used.
-h
-h is used to print out a short help text.
-S server
server is the name of the server you want to use.
-U username
username is the user name to use for the print request at the server.
-P password
password is the password to use for the print request at the server. If neither -n nor -P are given, and the user has no open connec-
tion to the server, nprint prompts for a password.
-n
-n should be given if no password is required for the print request.
-C
By default, passwords are converted to uppercase before they are sent to the server, because most servers require this. You can turn off
this conversion by -C.
-q queuename
queuename is the name of the print queue to use at the print server. At present, you must specify it in upper case characters.
-d job-description
job-description is the string that appears in pconsole when you list the jobs for the print queue. It will also appear in the "Descrip-
tion" field on the banner page.
-p pathname-in-banner
pathname-in-banner is the string (up to 79 characters) you want to be printed in the "Directory" field on the banner page.
-B username-in-banner
username-in-banner is the string (up to 12 characters) you want to appear on the lower part of the banner page. It will also appear in
the "User name" field.
-s
Supress printing of banner page
-f filename-in-banner
filename-in-banner is the string (up to 12 characters) you want to appear in large letters on the lower part of the banner page.
Default: the name of the file that is printed, or 'stdin'.
-l lines
lines is the number of lines to put on one page. Default: 66.
-r rows
rows is the number of rows to put on one page. Default: 80.
-c copies
copies tells the print server to the specified number of copies. Default: 1.
-t tabs
tabs is the number of spaces to print for a Tab-Character. Default: 8.
-T
tells the print server to expand Tab-Character and use 8 spaces
-N
tells the print server not to use Form Feeds
-F form-number
form-number is the the number of the form to be put into the printer. If it's different from the one currently in the printer, your job
is only printed if a printer operator has put in the correct form.
NOTES
The '-B' option was formerly '-b'. But it conflicted with 'bindery only' login option.
SEE ALSO
nwclient(5), slist(1), pqlist(1), ncpmount(8), ncpumount(8)
CREDITS
nprint was written by Volker Lendecke (lendecke@math.uni-goettingen.de)
nprint 12/27/1995 NPRINT(1)