Sponsored Content
Top Forums Shell Programming and Scripting How to replace the blank in unix Post 302454236 by bharathappriyan on Friday 17th of September 2010 12:15:06 PM
Old 09-17-2010
How to replace the blank in unix

Hi,

I have data like below: The columns MARKET ,STORE, WEEK1 will be present always. After that, there can be week2, week3 columns or some times there wont be no columns after week1. The week1 or week2 columns can have data or blank. I need to replace the blank with NIS.

Code:
MARKET,STORE,STORE NAME,WEEK1,WEEK2
MARKET,STORE1,STORENAM1, 000000003.99,
MARKET,STORE1,STORENAM2,NH,NH
MARKET,STORE1,STORENAM3, 000000003.99, 000000003.99
MARKET,STORE1,STORENAM4,,NH
MARKET,STORE1,STORENAM5,, 000000003.99
MARKET,STORE1,STORENAM6,, 000000008.60

Expected output:
Code:
MARKET,STORE,STORE NAME,WEEK1,WEEK2
MARKET,STORE1,STORENAM1, 000000003.99,NIS
MARKET,STORE1,STORENAM2,NH,NH
MARKET,STORE1,STORENAM3, 000000003.99, 000000003.99
MARKET,STORE1,STORENAM4,NIS,NH
MARKET,STORE1,STORENAM5,NIS, 000000003.99
MARKET,STORE1,STORENAM6,NIS, 000000008.60

I hope i am making you clear. if not, please let me know.

Thanks,
Selva

Last edited by Scott; 09-17-2010 at 01:18 PM.. Reason: Code tags, please...
 

10 More Discussions You Might Find Interesting

1. AIX

How can i replace a character with blank space?

i want a command for my script!!! say file consists of character 123 125 127. i need a query to replace the number 2 with 0 so the output should be 103 105 107. i use unix-aix (8 Replies)
Discussion started by: rollthecoin
8 Replies

2. Shell Programming and Scripting

Replace two blank line with a single blank line

Hi Guys, I have a file in which each set of records are separated by two blank line. I want to replace it with a single blank line. Can you guys help me out? Regards, Magesh (9 Replies)
Discussion started by: mac4rfree
9 Replies

3. Shell Programming and Scripting

how to replace a character with blank in a file

hi, I have a doubt in replacing characters with blank. My requirement is that, i have one file and looks like below 4:ALTER SYSTEM DISCONNECT SESSION '193,191' IMMEDIATE; 6:ALTER SYSTEM DISCONNECT SESSION '205,7274' IMMEDIATE; 5:ALTER SYSTEM DISCONNECT SESSION '206,34158' IMMEDIATE;... (4 Replies)
Discussion started by: sridhusha
4 Replies

4. Shell Programming and Scripting

Find and replace blank in the last field

Hi all, I have a huge file and I need to get ride of the fields 6-11 and replace the blanks in field 5 with a missing value(99999). 159,93848,5354,343,67898,45,677,5443,434,5545,45 677,45545,3522,244, 554,54344,3342,456, 344,43443,2344,444,23477... (12 Replies)
Discussion started by: GoldenFire
12 Replies

5. UNIX for Dummies Questions & Answers

Replace colon with blank space

Dear Gurus, I have a unix file with multiple colons on each row, and I would like to replace each colon with a blank space using the awk command. For example, I have the following data: Data: --------- A~000000000000518000~SLP:~99991231~20090701~00102.00~USD:~CS:~... (2 Replies)
Discussion started by: chumsky
2 Replies

6. Shell Programming and Scripting

Need help to replace a pattern with a blank line

Need help to replace the line beginning with tcp_sendspace with a blank line. # cat if en0: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN> inet 10.27.53.21 netmask 0xffffff00 broadcast 10.207.52.255 inet... (11 Replies)
Discussion started by: sags007_99
11 Replies

7. Shell Programming and Scripting

Replace with NA if blank is there

Hi All, please help me below request. i am having a file XXXX.dat. in Unix. example- plan_dk,imsmodelvar,paymt_type_az,mmars_plan,mmars_payer,mmars_pbm,account,botpbm,formulary_Crestor 0000000000,,3,MAIL ORDER,MAIL ORDER DATA,N/A,MAIL ORDER,N/A, 0000000000,6,,MAIL ORDER,MAIL ORDER... (10 Replies)
Discussion started by: krupasindhu18
10 Replies

8. UNIX for Dummies Questions & Answers

Replace character by blank

Hi all, I have 89 columns,1200 rows in a flat file, some of the values are just '.' (the character dot). I want to replace them by nothing (blank), but when I do so, it affects the decimal numbers too. so 12.34 becomes 1234. How can I just replace values which are only '.' with 1 white... (13 Replies)
Discussion started by: newbie83
13 Replies

9. Shell Programming and Scripting

How to replace blank tab with zero in a file?

hi, i need to replace a blank tab output in a file to zero. input file: 2015/08/04 00:00:00 171 730579 27088 <blank> 3823 30273 1621778 ... (6 Replies)
Discussion started by: amyt1234
6 Replies

10. Shell Programming and Scripting

In a file, replace blank line by the last line not blank above

Dear All, In a CSV file, say that a given column has been extracted. In that column, information is missing (i.e. blank lines appear). I would like to replace the blank lines by the last valid line (not blank) previously read. For example, consider the extract below: 123 234 543 111... (7 Replies)
Discussion started by: bagvian
7 Replies
semanage-dontaudit(8)													     semanage-dontaudit(8)

NAME
semanage dontaudit- SELinux Policy Management dontaudit tool SYNOPSIS
semanage dontaudit [-h] [-S STORE] [-N] {on,off} DESCRIPTION
semanage is used to configure certain elements of SELinux policy without requiring modification to or recompilation from policy sources. semanage dontaudit toggles whether or not dontaudit rules will be in the policy. Policy writers use dontaudit rules to cause confined applications to use alternative paths. Dontaudit rules are denied but not reported in the logs. Some times dontaudit rules can cause bugs in applications but policy writers will not relize it since the AVC is not audited. Turning off dontaudit rules with this command to see if the kernel is blocking an access. OPTIONS
-h, --help show this help message and exit -S STORE, --store STORE Select an alternate SELinux Policy Store to manage -N, --noreload Do not reload the policy after commit EXAMPLE
Turn off dontaudit rules # semanage dontaudit off SEE ALSO
selinux (8), semanage (8) AUTHOR
This man page was written by Daniel Walsh <dwalsh@redhat.com> 20130617 semanage-dontaudit(8)
All times are GMT -4. The time now is 06:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy