File name select to "clipboard"


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers File name select to "clipboard"
# 1  
Old 07-15-2012
File name select to "clipboard"

I want to be able to take a file name and then use
Code:
sed

to paste that text into the file.

I believe I know how to do the latter portion of pasting into the file at the location I want, but I do not know how to "copy" the file name to the "clipboard" for pasting.

Ideally I want to be able to do this for all files of any input extension in the dir tree, but I can settle my ambitions for just the file in the same directory.

Could anyone please help me determine the command or code?

Im using "Linux n1 2.6.18-194.3.1.el5 #1 SMP"
and Teraterm secure shell extension (ttssh) v1.5.4

Thanks!
# 2  
Old 07-15-2012
What do you mean by "clipboard"? Do you mean selecting something with your mouse? I hope not. If you put your sed command into a script:
Code:
#!/bin/bash
sed -i 's///' $1  # <-- your sed command, with $1 as file

Then make it executable:
Code:
chmod u+x mypaste.sh

And run it with the file being an argument :
Code:
 ./mypaste.sh somefileToBeHacked.txt

If you want to run it on the whole directory tree, get the filenames from find:
Code:
find /path/to/tree -type f | while read f  ; do 
  ./myscript.sh $f  
done

This User Gave Thanks to mirni For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

3. Shell Programming and Scripting

finding the strings beween 2 characters "/" & "/" in .txt file

Hi all. I have a .txt file that I need to sort it My file is like: 1- 88 chain0 MASTER (FF-TE) FFFF 1962510 /TCK T FD2TQHVTT1 /jtagc/jtag_instreg/updateinstr_reg_1 dff1 (TI,SO) 2- ... (10 Replies)
Discussion started by: Behrouzx77
10 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

Compare file names and select correct elements to include in "for each loop"

Hi everyone, I`ll try to be most clear I can explaining my help request. I have 2 folders Folder A-->This folder receives files through FTP constantly Folder B-->The files from Folder A are unzipped and then processed in Folder B Sometimes Folder A doesn`t contain all... (2 Replies)
Discussion started by: cgkmal
2 Replies

6. Shell Programming and Scripting

Why stderr file descriptor redirection makes ksh's "select" construct hang.

I am trying to use one global declaration --> "exec 2>$ERR" to capture all stderr outputs that may occur anywhere in my script. Then close it at the end of the script using --> "exec 2<&-" I am using KSH on Solaris 8. KSH Version M-11/16/88i If I comment two "exec .." statements in the... (11 Replies)
Discussion started by: kchinnam
11 Replies

7. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

8. UNIX for Advanced & Expert Users

"Unable to obtain clipboard ownership"

Help! I work on a PC running Windows XP. I have installed the Hummingbird Suite Exceed 10.0. I launch 4 Xconfig sessions based on different *.cfg files along with the standard Xserver Xconfig (Exceed.cfg). I do this because I need to run graphical apps in separate windows. In any event,... (0 Replies)
Discussion started by: richmeeker
0 Replies

9. Programming

How to convert the "select" function into a "poll" function

i have a program using the select function but i want to convert it to poll... how can i do this? thanks in advance... :) (1 Reply)
Discussion started by: rbolante
1 Replies
Login or Register to Ask a Question