10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have the requirement similar to the one mentioned in the below thread.
https://www.unix.com/unix-for-dummies-questions-and-answers/128155-search-replace-string-only-particular-column-delimited-file.html
The only difference is that I need to change the field for row 1,2 and the last... (14 Replies)
Discussion started by: chetanojha
14 Replies
2. 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
3. UNIX for Dummies Questions & Answers
Hi,
For example:
I have:
HostA,XYZ
HostB,XYZ
HostC,ABC
I would like the output to be:
HostA,HostB: XYZ
HostC:ABC
How can I achieve this?
So far what I though of is: (1 Reply)
Discussion started by: alvinoo
1 Replies
4. Shell Programming and Scripting
$ cat /cygdrive/d/Final2.txt
1,A ,Completed, 07.03_23.01 ,Jun 30 20:00
2,BBB,Pending,,
3,CCCCC,Pending,,
4,DDDDD,Pending,,
5,E,Pending,,
6,FFFF,Pending,,
7,G,Pending,,
In the above file 4th field is date which is in MM.DD_HH.MIN format and I need to convert it to as it is there in 5th... (1 Reply)
Discussion started by: Amit Joshi
1 Replies
5. Shell Programming and Scripting
Hello Group,
I need to replace the city field in “File 1 (fileld 3), with the entire record line of “File 2” (including delimiters) where the “city” field (File 1, Field 3)matches city field (File 2, Field1). All of the other data in “File 1” should remain intact(Fields 1,2,4,5,6). Only field... (1 Reply)
Discussion started by: vestport
1 Replies
6. Shell Programming and Scripting
Hi,
I've a file which is "|" delimited. I want to replace the first field with rownum, how can I do it with awk or sed command? There is no header record.
sample file
1195|ABC|DEF|30 LATE DR||CHARLOTTE|NC||NONE@NONE.COM|I|1
1227|PQR|STU|3 KING DR||LIVONIA|NJ|481524071|YAHOO@YAHOO.COM|I|3... (4 Replies)
Discussion started by: rudoraj
4 Replies
7. Shell Programming and Scripting
hi,
i have various csv files, the file format is as follows
Entry: "1",4,2010/08/15-10-00-00.01,,"E",,,,,,,,,120,0,"M4_","C","KEW-011-5337140-20100916163456-540097","1234567890","N N 0 ",,,"NUK 800100200",,,"NN",,,,,,,,,,,,"0000000001|0001|20150401... (2 Replies)
Discussion started by: niteesh_!7
2 Replies
8. Shell Programming and Scripting
Hi,
I am new to unix and am trying to do something below:
I have a pipe delimited file with millions of records. I need to replace the third column of the first record to the number of lines in the file. How can I do that.
Will appreciate any advice and help.
Thanks
Simi (3 Replies)
Discussion started by: simi28
3 Replies
9. Shell Programming and Scripting
I have to replace a field in one file with a field from other file.
I came across this awk command to replace a field with one string
nawk -F'|' -v OFS='|' '$2="replace"' temp2 > temp3
I need to have something like cut -f2 -d "|" temp1 (a field from other file) instead of 'replace'
Is... (8 Replies)
Discussion started by: savant
8 Replies
10. Shell Programming and Scripting
Hello all,
I've a CSV file and need to replace 5th field if its value is "X".
The exact requirement is to replace 5th field (column) with "Y" if
a. it's value is "X" AND
b. the line must start with ABC string
i guess this can be done with awk. Pl help.
For security reasons, the... (2 Replies)
Discussion started by: prvnrk
2 Replies