Need some explanations in commands


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Need some explanations in commands
# 1  
Old 12-17-2011
Need some explanations in commands

I want to know what's the meaning of the following commands

first eg
Code:
^[^aeiou]*a[^aeiou]*e[^aeiou]*i[^aeiou]*o[^aeiou]*u[^aeiou]*$

What does exactly the *a,*e,*i ...*$ means in this command?
I know that i can also use this command without the *a,*e,*i ... *$!
At this ocassion what's the difference?

second eg
Code:
sed ‘s/^/<tab>/’ file1

In sed command why do we use 's' and what's the meaning of it?
Also in sed when do i have to use the substitude command '1,$s'?

third eg
Code:
sed ‘1,/^$/d’ file1

At this example what does the '^$' means?
# 2  
Old 12-17-2011
Quote:
Originally Posted by kotsos13
I want to know what's the meaning of the following commands

first eg
Code:
^[^aeiou]*a[^aeiou]*e[^aeiou]*i[^aeiou]*o[^aeiou]*u[^aeiou]*$

What does exactly the *a,*e,*i ...*$ means in this command?
I know that i can also use this command without the *a,*e,*i ... *$!
At this ocassion what's the difference?
In a regular expression the splat (*), some people call it a star, means zero or more of the proceeding character. A simple example, /word */ will match 'word' followed by zero or more spaces. In the example you gave, [^aeiou] will match any character that is not a vowel. [^aeiou]*a will match zero or more non-vowels, followed by the letter 'a'. The same is true for the rest. So a string like hahhehhihhhohhhuhh would match the pattern, but heahehihohu would not since the first vowel is not an a.

Quote:
second eg
Code:
sed ‘s/^/<tab>/’ file1

In sed command why do we use 's' and what's the meaning of it?
Also in sed when do i have to use the substitude command '1,$s'?
The 's' is the substitute command. Anything that matches between the first pair of slant characters will be replaced with the string between the middle and last slant characters. In your example, the beginning of line is replaced with <tab>

Quote:
third eg
Code:
sed ‘1,/^$/d’ file1

At this example what does the '^$' means?
The '^' represents the beginning of the buffer, and '$' represents the end of the buffer. When put together, as in your example, it means the beginning and ending of the buffer are next to each other without any characters between (a blank line). This sed deletes blank lines.

Last edited by agama; 12-17-2011 at 05:55 PM.. Reason: typo
This User Gave Thanks to agama For This Post:
# 3  
Old 12-18-2011
Thank you very much for the help!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

I need some explanations

hello let me start with i am a php ,vb ,c# programmer i heared that Routers run a smaller version of linux called an Embedded Operating System i don't know what is that mean so i want to know how to get into router files ? how to edit it ? what language it use , is it c and c++ ?... (1 Reply)
Discussion started by: mr.vip
1 Replies

2. AIX

HACMP: difference between 'cl' commands and 'cli' commands

Hi all, I'm new in this forum. I'm looking for the difference between the HACMP commands with the prefix "cl" and "cli". The first type are under /usr/es/sbin/cluster/sbin directory and the second are under /usr/es/sbin/cluster/cspoc directory. I know that the first are called HACMP for AIX... (0 Replies)
Discussion started by: peppix
0 Replies

3. UNIX for Dummies Questions & Answers

Sensors Explanations

Hello, I am trying to get some information from the sensors on my pc. But i get confuse with what i get. I don t know where to find out which sensors watches what.. I use "sensors" under ubuntu 10.10. Here is the result of the cmd line sudo sensors. the temp 3 indicates 79°C which... (0 Replies)
Discussion started by: Mat_k
0 Replies

4. UNIX for Dummies Questions & Answers

Definitions/explanations

Just wondering: Can anyone tell me what is meant by the term 'interactive shell" or 'built-in commands' - for example, if I type 'man set' I get a page listing all the 'built in commands' but no explanation of what they are as a concept or what they do. And while I'm here: I was wondering as... (5 Replies)
Discussion started by: Straitsfan
5 Replies

5. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

6. UNIX for Dummies Questions & Answers

Vi Commands

Hi I have find in unix. A.txt /app01//fnd/11.5.0/bin/ADCONV /app01/fnd/11.5.0/bin/AFTBLGEN /app01/fnd/11.5.0/bin/FDULONG /app01/fnd/11.5.0/bin/FNDAQCT /app01/fnd/11.5.0/bin/FNDATUPD I want to make this as cp -i /db01//fnd/11.5.0/bin/ADCONV /app01//fnd/11.5.0/bin/ADCONV cp -i... (2 Replies)
Discussion started by: ronald_brayan
2 Replies

7. Programming

code that reads commands from the standard i/p and executes the commands

Hello all, i've written a small piece of code that will read commands from standard input and executes the commands. Its working fine and is execting the commands well. Accepting arguments too. e.g #mkdir <name of the directory> The problem is that its not letting me change the directory i.e... (4 Replies)
Discussion started by: Phrozen Smoke
4 Replies

8. IP Networking

ping program with explanations please!!!!!

need help!! need a ping program written in c with the explanations as to what each variable,function does!!! please help!! (4 Replies)
Discussion started by: sachin_zeus
4 Replies
Login or Register to Ask a Question