Help with ls to input for simultaneous editing


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help with ls to input for simultaneous editing
# 1  
Old 11-13-2011
Question Help with ls to input for simultaneous editing

I just registered today and started unix about a month ago.

I'm trying to make a script where I can add commands or text to the end of files in a listing.

Code:
 
$ echo "#text_or_command" >> #List of files from ls

I can't seem to find/understand it on these fourms.
Could it be done at all?
# 2  
Old 11-13-2011
Code:
ls | xargs -i bash -c 'echo "#text_or_command" >> {}'

This User Gave Thanks to bartus11 For This Post:
# 3  
Old 11-13-2011
What goes in the {}'?

---------- Post updated at 05:53 PM ---------- Previous update was at 05:39 PM ----------

.. nvm
# 4  
Old 11-15-2011
hey how could it be done if i wanted line of text to be deleted from all of those same files.
# 5  
Old 11-16-2011
Is the line to be deleted selected by line number?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Simultaneous calling of url

Hello I want to call multiple sites simultaneously by xargs or parallel for example a.com/srv/1 a.com/srv/3 a.com/srv/2 a.com/srv/n That means 500 different sites will be called in a moment Then I use command I call a url at the same time. I need to call each url once, but every 500... (1 Reply)
Discussion started by: mnnn
1 Replies

2. Homework & Coursework Questions

Limit simultaneous file access

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: So my problem is: 4990 of 5000 users should be able to access a file. How can this be accomplished. 2.... (1 Reply)
Discussion started by: protiss
1 Replies

3. Shell Programming and Scripting

input a file editing it, output it.

i have a file that contains such earthquake data, i want to write an AWK or SED script to input it and fix it (delete each section header delete some field, delete some blank lines and put ### instead of that) and at the end output it to a new file. here is my file: EventID Date (UTC)... (2 Replies)
Discussion started by: oreka18
2 Replies

4. Shell Programming and Scripting

run script simultaneous

I have 5 scripts, basicly do the same thing. Use expect and telnet to devices. First set the variables and the script as follow spawn telnet $ipaddr expect "Username:" send -- "$usuario\r" expect "Password:" send -- "$password\r" send -- "\r" send -- "\r" send -- "copy running-config... (6 Replies)
Discussion started by: robonet
6 Replies

5. Shell Programming and Scripting

Cron job to prevent simultaneous script

I'm using a shared server on Hostgator (Linux CentOS). I'm trying to set a cron job using the Control Panel that will check if its already running before starting a new one. I've tried the following... * * * * * && but I get this error emailed to me... /bin/sh: line 0: Any... (5 Replies)
Discussion started by: tech9821
5 Replies

6. UNIX for Dummies Questions & Answers

Simultaneous file read operation

Hi All, I need information on file handling in UNIX enviornment. If in UNIX enviornment I have two process.. P1 P2 Both accessing the same file simultaneosuly(read operation).. Suppose P1 opened the file in read mode first and started reading the file.. Then P2 opens the same file in... (5 Replies)
Discussion started by: chibob
5 Replies

7. UNIX for Dummies Questions & Answers

Problems with simultaneous access to a server

Hello, I'm working in a project where several procedures are programmed using UNIX scripts. One of these scripts is launched in several threads. When performing these threads an scp command to another server it gives out. This error happens only sometimes, others not and each time for a... (5 Replies)
Discussion started by: Hector_Saura
5 Replies

8. UNIX for Dummies Questions & Answers

simultaneous network start

Hi! I need to start a program at several hosts in the network at the same time. Starting time difference should be no more than several milliseconds. What is the best way to do that? Thanks! (5 Replies)
Discussion started by: harjar
5 Replies

9. Shell Programming and Scripting

running simultaneous awks

Hello, I have an awk command that searches and replaces. I have multiple searches, but I do not want to do them one after the other. Is there a way in awk to run search/replace at the same time. thanks, (3 Replies)
Discussion started by: ctcuser
3 Replies

10. UNIX for Dummies Questions & Answers

Simultaneous printing

I am running AIX 4.3 and network printing setup with HP Jetdirect. I would like to be able to send the same printout to both of the network printers at the same time. They are both PCL data stream. I have tried to make this work by linking the two print que, by the results are unpredictable. Is... (1 Reply)
Discussion started by: sjk303
1 Replies
Login or Register to Ask a Question