LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   scripting (https://www.linuxquestions.org/questions/linux-general-1/scripting-646878/)

phsythax 06-04-2008 02:28 AM

scripting
 
I've got a large text file, and i would like to replace some strings on each line, e.g.

i've got lines like these:

a b c
a b c
a b c

i would like to move the strings so that the lines end up looking like this:

b a c
b a c
b a c

"b", "a" and "c" are just variables, the actual content change, but the positioning of the content are the same.

My question is, What commands should i use to solve my problem?

jschiwal 06-04-2008 02:32 AM

If the strings are structured like records, you can easily use awk to print out the fields in any order you want.

pixellany 06-04-2008 07:22 AM

Are you trying to change things based on position or content? e.g., do you want to:

--move all occurrences of "b" to the front.

OR

--move the second field to the front.


All times are GMT -5. The time now is 02:24 AM.