The given command will print the lines which matches for the word ‘Sysadmin’ to 6th line in a file (if available) . Since first line matches for the word ‘Sysadmin’ it prints the first line to 6th line. And 10th line (last) line also matches to the given word, so it prints.

In an organisation one wants to know how many programmers are there. The employee data is stored in a file called ‘personnel’ with one record per employee. Every record has field for designation. How can sed be used to print only the records of all employees who are programmers ?

Hi,
There are some problems I am facing with linux right now.
This is what I am doing to generate a cryptographic signature fron bash script….

step1. I encrypt a text : encrypt(bhavyakailkhurabhavyakailkhura) and get a encrypted string sdfghjklsdfghjklzxcvbnmghjkdfghjkzxcvbnmzxc
step2. I copy that string manually from mouse no commands used and append it with a file..

step3. Using “sed” on text file I send text between “{” and “}” to another file bhavya.txt
step4. now when I try to decrypt bhavya.txt it say error in reading file. I checked the text is same as encrypted. When I copy original encrypted text in step 1 and decrypt It works.

I think the problem is sed command changes spacing between text its not same as copying using mouse. Do you have any idea how we can solve this problem?

I would like to subsitute the comma in the amount enclosed in double quote only and leave all the comma as it. How can I do it?R,112074121151,45891,SMITH,JOHN ,HELLEN,”$1,078.67″,1118.69
Thank you.
Hedy

Hi., i want to change the extension of my all files which are in current dir. via using sed command………….. , i m trying this code in a shell script
#!/bin/bash
for file in *
do
NEW=”echo $file|sed -f ‘s/.txt.new/.txt/g'”
mv $file $NEW
done

when i m running this shell script, o/p is :-
mv: target `\’s/txt.new/txt/g\” is not a directory

Sed Pattern Format 6: /PATTERN/,/PATTERN/
Prints the section of file between two regular expression (including the matched line ).

when used in loop it is printing the whole file.
ex:
for i in `cat file` ; do sed ‘/$i/,/$i/p’ filename ;done
my file has 3 entries .for every iteration it is printing all the lines i.e. my output seems to be 3*file conent.

HI Can any one tell me hwo to write a code for below :
From the command zpool status
zpool status -x
pool: tank
state: DEGRADED
status: One or more devices could not be opened. Sufficient replicas exist for
the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using ‘zpool online’.
see: http://www.sun.com/msg/ZFS-8000-D3
scrub: resilver completed with 0 errors on Fri Mar 17 14:38:47 2006
config:

About The Geek Stuff

My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about Ramesh Natarajan and the blog.

Contact Us

Email Me :
Use this Contact Form to get in touch me with your comments, questions or suggestions about this site. You can also simply drop me a line to say hello!.