Hi,
I can only assist with an awk script. Lets assume the file is as below.
[collins@Methuselah ~]$ cat my_file
when,where,how,why
23,3,,90
cat,dog,cow,hare
car,bike,,truck
Result.
[collins@Methuselah ~]$ awk -F"," -v OFS=, '{$3="VALUE"; print $0 }'
my_file
when,where,VALUE,why
23,3,VALUE,90
cat,dog,VALUE,hare
car,bike,VALUE,truck
Am not sure of a one line sed command.
On Mon, Feb 3, 2014 at 12:25 PM, loial <[email protected]> wrote:
> I have a comma seperated file and I need to replace the contents of column
> 3 in every line with the same value.
>
> However the existing content of this column is variable(and can be
> non-existent i.e no value between the commas, so I cannot do a straight
> replacement to every line.
>
> Is this possible to do in sed?
>
>
>
>
>
>
> --
> --
> You received this message because you are subscribed to the Linux Users
> Group.
> To post a message, send email to [email protected]
> To unsubscribe, send email to [email protected]
> For more options, visit our group at
> http://groups.google.com/group/linuxusersgroup
> References can be found at: http://goo.gl/anqri
> Please remember to abide by our list rules (http://tinyurl.com/LUG-Rulesor
> http://cdn.fsdev.net/List-Rules.pdf)
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Linux Users Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
In a world without walls and fences, who needs Windows and Gates
--
--
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit our group at
http://groups.google.com/group/linuxusersgroup
References can be found at: http://goo.gl/anqri
Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules or
http://cdn.fsdev.net/List-Rules.pdf)
---
You received this message because you are subscribed to the Google Groups
"Linux Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.