how to put a # in a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to put a # in a file
# 8  
Old 12-19-2007
Modify as per ur requirment

sed -e 's/pop3/#pop3/g' -e 's/named/#named/g' -e 's/smtpd/#smtpd/g' /etc/inetd

To replace the first occurace only you can do this

sed -e 's/pop3/#pop3/1' -e 's/named/#named/1' -e 's/smtpd/#smtpd/1' /etc/inetd


If you want insert '#' in the line start with smptd,named,pop3 then u can use this
sed -e 's/^pop3/#pop3/1' -e 's/^named/#named/1' -e 's/^smtpd/#smtpd/1' /etc/inetd
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract data from a log file and put it in a file

Hi, I would like to seek your help for a script that will extract data from log file and put it in a file. Sample log file 2018-10-23 12:33:21 AI ERROR -- tpid: SAMPLE_TH account: 123456789 aiSessionNumber: 660640464 mapName: xxx to yyy errorDesc: Translation Error:ErrorNumber : 993 ... (2 Replies)
Discussion started by: neverwinter112
2 Replies

2. Shell Programming and Scripting

Get Data From CSV File and put into a txt file

Hi Guys, File A I have File A as CSV Format.... No R SS MK Par value S AL A1 PKL123 Lo12 1 S AL A2 PKl123 Lo34 22 S AL A3 PkLK234 Lo67 -34 S AL A4 PkLK235 Lo09 120 S AL A5 PkLK236 Lo76 19 S AL A6 PkLK237 Lo44 -17 S AL A7 PkLK238 Lo90 2 S AL A8 PkLK239 Lo34 -9 I want file B like... (4 Replies)
Discussion started by: asavaliya
4 Replies

3. UNIX for Dummies Questions & Answers

put script into file

hi, ok having here some code like: #!/bin/bash echo " hello " # say hello to the user echo " $HOME " echo " $HOSTNAME " echo " $(uname) " echo " today is $(date) " echo " $(whoami) is currently logged in " now my question is how to change the code so that the info is not... (12 Replies)
Discussion started by: me.
12 Replies

4. Shell Programming and Scripting

split input data file and put into same output file

Hi All, I have two input file and need to generate a CSV file. The existing report just "GREP" the records with the Header and Tailer records with the count of records. Now i need to split the data into 25 records each in the same CSV file. id_file (Input file ) 227050994 232510151... (4 Replies)
Discussion started by: rasmith
4 Replies

5. Shell Programming and Scripting

Get a column from one file and put it in another

I have 2 files that I would need from one file the 3rd column and put into the second file. Preferably in KSH . For example file one has file1: Column 1 Column 2 Column 3 Column 4 Column 5 file2: Column 1 Column 2 Column 3 Column 4 Column 5 So take Column 3 and put into file1 making it... (4 Replies)
Discussion started by: bombcan1
4 Replies

6. UNIX for Dummies Questions & Answers

I want some selected data from first file and put into other file in specified format

I have a file with follwing content ---------------------------------- SCHEDULE XXXXXXXXX#JOBCOUNT ON EVERYDAY AT 0000 PRIORITY 50 SCHEDULE XXXXXXXXX#ABCDEFGH ON EVERYDAY AT 0001 PRIORITY 29 SCHEDULE... (5 Replies)
Discussion started by: shreyas
5 Replies

7. Shell Programming and Scripting

Put two lines into one from file

Hello, I have a script that generates the following file named /tmp/rfkill: rf55 pts/13 Jul 10 06:38 (10.72.11.44) 15782 pts/13 5:07 b rf56 pts/15 Jul 10 06:53 (10.72.11.9) 18552 pts/15 0:28 b rf55 pts/39 Jul 10 09:12 (10.72.11.44) 19354 pts/39... (4 Replies)
Discussion started by: raidzero
4 Replies

8. Shell Programming and Scripting

TOP out put to a file

How to copy a top output to some file...! i am getting a blank data only top << file1 (2 Replies)
Discussion started by: bullz26
2 Replies

9. UNIX for Advanced & Expert Users

Put strings around the file name

I have a file(old file) with names in it like Jolly Mirani Han Lee stuart Lloyd I want string to be added to these names . New file should look like 'jolly mirani' 'han lee' 'stuart lloyd' I tried using sed command but doesn't work for string but it do work for paranthesis. Can some one... (3 Replies)
Discussion started by: Jolly
3 Replies

10. UNIX for Dummies Questions & Answers

Take a file from the system and put on tape and reset the file to 0 bytes

:mad: I did this the other day but one of my support personnel removed my history so i could call it back up to remeber the exact command since i am air-headed at times. I am trying to take a 30 MEG file off the system and drop it to tape then i want to make the file go back to being 0 bytes so... (1 Reply)
Discussion started by: JackieRyan26
1 Replies
Login or Register to Ask a Question
MBRLEN(3)						   BSD Library Functions Manual 						 MBRLEN(3)

NAME
mbrlen, mbrlen_l -- get number of bytes in a character (restartable) LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <wchar.h> size_t mbrlen(const char *restrict s, size_t n, mbstate_t *restrict ps); #include <wchar.h> #include <xlocale.h> size_t mbrlen_l(const char *restrict s, size_t n, mbstate_t *restrict ps, locale_t loc); DESCRIPTION
The mbrlen() function inspects at most n bytes, pointed to by s, to determine the number of bytes needed to complete the next multibyte char- acter. The mbstate_t argument, ps, is used to keep track of the shift state. If it is NULL, mbrlen() uses an internal, static mbstate_t object, which is initialized to the initial conversion state at program startup. It is equivalent to: mbrtowc(NULL, s, n, ps); Except that, when ps is a NULL pointer, mbrlen() uses its own static, internal mbstate_t object to keep track of the shift state. Although the mbrlen() function uses the current locale, the mbrlen_l() function may be passed a locale directly. See xlocale(3) for more information. RETURN VALUES
The mbrlen() functions returns: 0 The next n or fewer bytes represent the null wide character (L''). >0 The next n or fewer bytes represent a valid character, mbrlen() returns the number of bytes used to complete the multibyte character. (size_t)-2 The next n contribute to, but do not complete, a valid multibyte character sequence, and all n bytes have been processed. (size_t)-1 An encoding error has occurred. The next n or fewer bytes do not contribute to a valid multibyte character. EXAMPLES
A function that calculates the number of characters in a multibyte character string: size_t nchars(const char *s) { size_t charlen, chars; mbstate_t mbs; chars = 0; memset(&mbs, 0, sizeof(mbs)); while ((charlen = mbrlen(s, MB_CUR_MAX, &mbs)) != 0 && charlen != (size_t)-1 && charlen != (size_t)-2) { s += charlen; chars++; } return (chars); } ERRORS
The mbrlen() function will fail if: [EILSEQ] An invalid multibyte sequence was detected. [EINVAL] The conversion state is invalid. SEE ALSO
mblen(3), mbrtowc(3), multibyte(3), xlocale(3) STANDARDS
The mbrlen() function conforms to ISO/IEC 9899:1999 (``ISO C99''). BSD
April 7, 2004 BSD