Search Results

Search: Posts Made By: daikeyang
15,323
Posted By daikeyang
truncate a string from the end
hi, guys. I have a question.

If I have a long string like this:

8.0K:/home/test/brownj

How can I get a substring which starts from the last slash to the end of the string, so in this case,...
5,093
Posted By daikeyang
Hi, cfajohnson. The code works well. Thanks...
Hi, cfajohnson.

The code works well. Thanks for the reply. Again, I am very confused.. :)

-Keyang
5,093
Posted By daikeyang
Hi, daptal. I will miss the ":" after 206 if I...
Hi, daptal. I will miss the ":" after 206 if I used this code :)

-Keyang
3,700
Posted By daikeyang
Hi, idapswandog. Thanks for the...
Hi, idapswandog.

Thanks for the explaination. :)

But the line below I am not quite agree with you.

&& substr($1,7,2) ~ /j/ # AND containing a 'j' in positions 7 or 2 of field 1

This...
5,093
Posted By daikeyang
How can I append a string at the end of a line in a file
Hi, guys. I have one question:

I have a file called "group", the contents of it is below:

********************************
...
test:x:203:
sales:x:204:
repair:x:205:
research:x:206:brownj...
3,700
Posted By daikeyang
Hi, cfajohnson. Thank you very much for you...
Hi, cfajohnson.

Thank you very much for you reply. The answer is short but confused :)

-Keyang
3,700
Posted By daikeyang
grep with regular expression
Hi, guys. I have one question, hope somebody can give me a hand

I have a file called passwd, the contents of it arebelow:

***********************
...
goldsimj:x:5008:200:...
18,449
Posted By daikeyang
Hi, Kenjackson Thank you very much for your...
Hi, Kenjackson

Thank you very much for your replay!

-Keyang
11,974
Posted By daikeyang
Hi, fpmurphy. Your code works, but it has a...
Hi, fpmurphy.

Your code works, but it has a problem in my case, it always gives me 2 messages:

join: File 1 is not in sorted order
join: File 2 is not in sorted order

Then I user sort...
9,736
Posted By daikeyang
Hi, Vgersh99. Thank you very much for your...
Hi, Vgersh99.

Thank you very much for your reply!

-Keyang
11,974
Posted By daikeyang
merge two files into one file use awk
Hi, guys. I have one question:

I have two files: passwd and shadow (the number of records in these files are not equal)the contents of them are below:

passwd:

**************
ftp:x:24:24:...
9,736
Posted By daikeyang
Hi, Dan. The code doesn't work for my case,...
Hi, Dan.

The code doesn't work for my case, the same problem I met before with my code. It seems that I cannot pass any variable to awk and sed.

@general:

Is there anybody know how to solve...
9,736
Posted By daikeyang
Hi, Dan. Thanks for answering again! I...
Hi, Dan.

Thanks for answering again! I will try it out.

But can you tell me what is wrong with my code? if I don't use variables in my code, it works well. For example:

sed...
9,736
Posted By daikeyang
Hi, ghostdog74. I am not supposed to use...
Hi, ghostdog74.

I am not supposed to use commands like suspend and passwd for this exercise. :(

Still, thanks for the reply. :)

-Keyang
9,736
Posted By daikeyang
hi, ghostdog74. I am not changing the...
hi, ghostdog74.

I am not changing the password in this way, I want to suspend the user, I add a string to the encrypted password, so the user is not able to login. I am new to Linux, so I do not...
9,736
Posted By daikeyang
search a line and insert string into specific at position
Hi, guys. I have one question:

How can I search for a line with certain string in it and then insert a string into this line?
For example:

There is a file called shadow, the contents of it are...
1,983
Posted By daikeyang
Hi, Dan Thank you very much for your reply. ...
Hi, Dan

Thank you very much for your reply.

-Keyang
1,983
Posted By daikeyang
How to find the lines which do not have certain strings
Hi, guys. I have one question:

How can I search the lines in a file which do not have certain string in it.

For example, the file is called shadow, the contents of it is below:
...
18,449
Posted By daikeyang
How to suspend a user account?
Hi, guys. I have two questions:

I need to write a script, which can show all the non-suspended users on system, and suspend the selected user account.

There are two things I am not sure:

1....
2,521
Posted By daikeyang
Hi, Franklin52: Thank you very much for your...
Hi, Franklin52:

Thank you very much for your reply, it works well!

-Keyang
2,521
Posted By daikeyang
Remove a line from a file
Hi ,guys. I have one question:

I want to write a script which removes a line with certain string from a file, for example

The name of the file is: "passwd", the contents of it is below:
...
8,433
Posted By daikeyang
Hi, guys. Thanks for replying. And I will...
Hi, guys. Thanks for replying.

And I will add answer next. Apologize for that:)
8,433
Posted By daikeyang
Found the answer.
Found the answer.
8,433
Posted By daikeyang
Search for string in a file and extract another string to a variable
Hi, guys. I have one question:

I need to search for a string in a file, and then extract another string from the file and assign it to a variable.

For example:

the contents of the file...
Showing results 1 to 24 of 24

 
All times are GMT -4. The time now is 08:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy