![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| prepend columns to a file | ChicagoBlues | UNIX for Dummies Questions & Answers | 3 | 10-22-2008 02:00 PM |
| Append text at end of the first line in a file | catgovind | Shell Programming and Scripting | 7 | 05-01-2008 08:33 AM |
| read list of filenames from text file, archive, and remove | fxvisions | Shell Programming and Scripting | 5 | 03-20-2007 09:56 PM |
| how to append text into a file. | beilstwh | Shell Programming and Scripting | 2 | 03-06-2007 05:51 PM |
| can I save list of files in memory and not in text file? | umen | Shell Programming and Scripting | 1 | 06-05-2006 05:27 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Append and Prepend Text to a file list
I want to print out a directory listing, then append [[ to the beggining and ]] to the end of each line. I'm trying to create a list of Wiki links based on folder listings that i can just copy and paste without having to edit 100's of file listings.
Using sed i've figured out to do something like this: sed "s/$/]]/g" documentation.txt > test.txt How do i do the prepend? And how do i put this into one line of code that i can possibly pipe the directoryling listing to sed.. ls /documentation | sed .... etc Thanks! CapnDoody (Chris) |
|
||||
|
Clarify Code
Can you break down that code for me? What is $0 doing for us? Placeholder for each line starting at 0? How would is use awk if i wanted to input a file and output to new file? Code:
awk '{print "[["$0"]]"}' firstfile.txt >> newfile.txt
Thanks! Just not really versed in awk (and by that i mean i have no idea how to use it
|
![]() |
| Bookmarks |
| Tags |
| sed prepend append text |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|