10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Need to replace last field in a file(/etc/passwd) ,if first filed matches with particular username.
Scenario:
cat testfor1
deekshi:x:7082:7082::/home/deekshi:/bin/bash
harini1:x:7083:7083::/home/harini1:/bin/bash
Here,if first field contains "deekshi", then i should replace... (4 Replies)
Discussion started by: Sumanthsv
4 Replies
2. Shell Programming and Scripting
Hello,
I have a text file in the below format:
Source Destination State Lag Status
CQA02W2K12pl:D:\CAQA ... (10 Replies)
Discussion started by: pocodot
10 Replies
3. Shell Programming and Scripting
I am working on a script to convert bank data to a csv file. I have the format done - columns etc. The final piece of the puzzle is to change the second field (after the R) of every line to reflect its' line number in the file. I am stumped. I can use awk on each line but need help looping through... (9 Replies)
Discussion started by: Melah Gindi
9 Replies
4. Shell Programming and Scripting
Hi all,
I have a requirement to replace a field with a character as per the length of the field.
Suppose i have a file where second field is of 20 character length. I want to replace second field with 20 stars (*). like ********************
As the field is not a fixed one, i want to do the... (2 Replies)
Discussion started by: gani_85
2 Replies
5. Shell Programming and Scripting
Hi Guys
I have the following file
Essentially, I am trying to find the right awk/sed syntax in order to produce the following 3 distinct files from the file above:
Basically, I want to print the lines of the file as long as the second field of the current line is equal to the... (9 Replies)
Discussion started by: moutaye
9 Replies
6. Shell Programming and Scripting
QUESTION 1:
How do you replace a specific line (i.e. line 4) with a new user defined line (i.e. the contents of SAMS’s name, history, math and English grades have been set already). I have been attempting to use SED (FYI: I don’t have GNU SED) or AWK, but haven’t had any luck. FYI: I am using... (1 Reply)
Discussion started by: thibodc
1 Replies
7. Shell Programming and Scripting
I'm trying to update a text file via sed/awk, after a lot of searching I still can't find a code snippet that I can get to work.
Brief overview:
I have user input a line to a variable, I then find a specific value in this line 10th field in this case. After asking for new input and doing some... (14 Replies)
Discussion started by: crownedzero
14 Replies
8. UNIX for Dummies Questions & Answers
Hi all,
I'm writing a script in bash where i'm reading line by line into variable,
and the i want to replace the second filed in the line with another number,
for example if the line looks like this:
10 20 30 40 50
it should look like this:
10 90 30 40 50
and put the new result inside... (1 Reply)
Discussion started by: morfix
1 Replies
9. UNIX for Dummies Questions & Answers
I have a file 'test.out' with contents:
1|1|10|10|I|asdf|
2|1|10|10|I|sdfg|
4|1|10|10|I|hgfj|
34|0|10|10|I|sdg|
I want to modify the fifth column with value 'I' to 'A' for only the last line. Below is what I expect to see:
1|1|10|10|I|asdf|
2|1|10|10|I|sdfg|
... (3 Replies)
Discussion started by: ChicagoBlues
3 Replies
10. UNIX for Dummies Questions & Answers
I need to edit the password file to change the password field to *LK* for a specified account (abctest) like:
abctest:*LK*:135:20::/home/abctest:/sbin/sh
Can anyone help me do this using ed or sed?
Thanks a lot! (6 Replies)
Discussion started by: munch
6 Replies