Sponsored Content
Top Forums Shell Programming and Scripting exchange values in a table - exchange numbers Post 302714703 by @man on Friday 12th of October 2012 12:54:57 PM
Old 10-12-2012
exchange values in a table - exchange numbers

Hello all,

This is a bit simple but I cannot do it! I have a big table of values between 0 and 1. some cells have NA instead of having any value.

I want to exchange all values with "1" and write "0" for all "NA" .

for changing "NA" to zero I used sed:
Code:
sed -i 's/NA/0/g' input.txt

But I have no clue for changing all numbers to 1.

I appreciate if you can help me with this.

---------- Post updated at 06:54 PM ---------- Previous update was at 06:47 PM ----------

I have managed to do it with this:

Code:
sed -e 's/[0-9]*\.[0-9]*/1/g' -e 's/NA/0/g' in.txt > out.txt

I hope it's correct! Smilie
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

mail exchange

Hi everyone I am setting up my own web hosting and dns server - have got all the dns and web server things sorted out. I am wondering if anyone knows what I need to do to enable my customers to have their own pop and smtp access under their own domains which they host with me. I have two ip... (2 Replies)
Discussion started by: alwayslearningunix
2 Replies

2. Windows & DOS: Issues & Discussions

Connecting to an Exchange Server

Hi, I have installed Redhat 7.3 on my desktop at work and was wondering whether I can set up my mail in KDE(Kmail, Mozilla Mail etc) to connect to a microsoft exchange server. Thanks for any help! (2 Replies)
Discussion started by: camerja1
2 Replies

3. UNIX for Dummies Questions & Answers

mailing from unix -> exchange

Hello, I want to mail from Unix 4.3 (on an RS/6000) to my Microsoft exchange server (5.5). When I trie : mail -v erikr@domain.nl < /directory/file I get the following error: ^Cserverone:/etc >WARNING: The local host name (serverone) does not have a domain; fix$jnconfig ... (7 Replies)
Discussion started by: Erik Rooijmans
7 Replies

4. UNIX for Dummies Questions & Answers

Mail Exchange Server

I've got a question regarding setting up mail between two unix boxes. Is it possible to setup two boxes conected via a hub and allow them to send mail using the Netscape Messenger. I know that I can be done so using the UNIX sendmail but I need to connect them via Messenger as my ultimate goal is... (0 Replies)
Discussion started by: GlockCW
0 Replies

5. Windows & DOS: Issues & Discussions

exporting exchange information

Hey all, I have teh job of exporting all the information for around 500 e-mail addresses from exchange into something like a excel sheet. I was pretty quiet one afternoon last week (and bore) so I added them to my adddresses book then exported them to excel. But I now have a problem, it does... (0 Replies)
Discussion started by: woofie
0 Replies

6. AIX

Relay to Exchange Server

AIX 5.3 Domain: domainna Exchange Server: ex05.domainname.com Our emails that are generated from Unix going to the "outside world" are now being rejected by most hosts. The current relay is listed as user@domainna. Here is a snippet from the log... 1356561:Aug 21 08:04:05 domainna... (0 Replies)
Discussion started by: andrewsc
0 Replies

7. AIX

Exchange one server to another

Hi people, In my work i have 2 P595 server (P595A and P595B) i need to exchange one server from P595A to P595B and one from P595B to P595A, i know the best way to do this is make a mksysb copy of the system and restore it on another but, in this process i dont need to exchange all the server,... (4 Replies)
Discussion started by: anonymouzz
4 Replies
dos2unix(1)						      General Commands Manual						       dos2unix(1)

NAME
dos2unix - DOS/MAC to UNIX text file format converter SYNOPSYS
dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...] Options: [-hkqV] [--help] [--keepdate] [--quiet] [--version] DESCRIPTION
This manual page documents dos2unix, the program that converts plain text files in DOS/MAC format to UNIX format. OPTIONS
The following options are available: -h --help Print online help. -k --keepdate Keep the date stamp of output file same as input file. -q --quiet Quiet mode. Suppress all warning and messages. -V --version Prints version information. -c --convmode convmode Sets conversion mode. Simulates dos2unix under SunOS. -o --oldfile file ... Old file mode. Convert the file and write output to it. The program default to run in this mode. Wildcard names may be used. -n --newfile infile outfile ... New file mode. Convert the infile and write output to outfile. File names must be given in pairs and wildcard names should NOT be used or you WILL lost your files. EXAMPLES
Get input from stdin and write output to stdout. dos2unix Convert and replace a.txt. Convert and replace b.txt. dos2unix a.txt b.txt dos2unix -o a.txt b.txt Convert and replace a.txt in ASCII conversion mode. Convert and replace b.txt in ISO conversion mode. Convert c.txt from Mac to Unix ascii format. dos2unix a.txt -c iso b.txt dos2unix -c ascii a.txt -c iso b.txt dos2unix -c mac a.txt b.txt Convert and replace a.txt while keeping original date stamp. dos2unix -k a.txt dos2unix -k -o a.txt Convert a.txt and write to e.txt. dos2unix -n a.txt e.txt Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt. dos2unix -k -n a.txt e.txt Convert and replace a.txt. Convert b.txt and write to e.txt. dos2unix a.txt -n b.txt e.txt dos2unix -o a.txt -n b.txt e.txt Convert c.txt and write to e.txt. Convert and replace a.txt. Convert and replace b.txt. Convert d.txt and write to f.txt. dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt DIAGNOSTICS
BUGS
The program does not work properly under MSDOS in stdio processing mode. If you know why is that so, please tell me. AUTHORS
Benjamin Lin - <blin@socs.uts.edu.au> Bernd Johannes Wuebben (mac2unix mode) <wuebben@kde.org> MISCELLANY
Tested environment: Linux 1.2.0 with GNU C 2.5.8 SunOS 4.1.3 with GNU C 2.6.3 MS-DOS 6.20 with Borland C++ 4.02 Suggestions and bug reports are welcome. SEE ALSO
unix2dos(1) mac2unix(1) 1995.03.31 dos2unix v3.0 dos2unix(1)
All times are GMT -4. The time now is 08:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy