Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
> ls
abcd.config efgh.config ijkl.config
Makefile:
%_defconfig: %.config
#echo "Some commands i want to run on %.config"
What i want is autosuggestion (tab completion) for
abcd_defconfig
efgh_defconfig
ijkl_defconfig
Explicitly declare the targets for which you want auto completion? For instance with the wildcard and patsubst functions and a static pattern rule instead of a pattern rule:
configs := $(wildcard *.config)
defconfigs := $(patsubst %.config,%_defconfig,$(configs))
$(defconfigs): %_defconfig: %.config
#echo "Some commands i want to run on $<"
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
file 1
23
1030042388
0
1.000000000000000
739203
0.041035795614451
754163
0.010276519532845
827907
0.147827256904898
2961752
0.017365353262416
3006283
The above file gets updated as
file1
23
1030042388
0
1.000000000000000
739203
0.041035795614451
754163
0.007314889610240
130695515
0.010276519532845
827907
0.147827256904898
2961752
0.017365353262416
3006283
0.000185740873681
13483011
0.028083838182834
13497795
0.011287502580049
13512752
0.219960404756292
13512755
Note updation can happen any where in the file, and numbers/lines should not be sorted
i need to capture only the update part in to other file
file 3
0.007314889610240
130695515
0.000185740873681
13483011
0.028083838182834
13497795
0.011287502580049
13512752
0.219960404756292
13512755
Could you please help me in this
Thanks
Using comm:
% comm -13 <(sort f1.txt) <(sort f2.txt)
0.000185740873681
0.007314889610240
0.011287502580049
0.028083838182834
0.219960404756292
130695515
13483011
13497795
13512752
13512755
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm working on redHat linux.
I've a file which looks like :
$vi filename
Jan,1,00:00:01,someone checked your file
Jan,3,09:38:02,applebee
Jan,16,10:20:03, ****************
Jan,18,03:04:03, ***************
I want the output to look like:
2015/01/01,00:00:01,someone checked your file
2015/01/03,3,09:38:02,applebee
2015/01/16,16,10:20:03, ****************
2015/01/18,03:04:03, ***************
Please help me to do this. Thanks
If you have GNU date, try:
$ awk -F, '{cmd="date -d \""$1" "$2"\" +%Y/%m/%d"; cmd|getline d; print d","$3","$4; close(cmd)}' file
2015/01/01,00:00:01,someone checked your file
2015/01/03,09:38:02,applebee
2015/01/16,10:20:03, ****************
2015/01/18,03:04:03, ***************
This approach cannot be used with the BSD (OSX) version of date because it does not support any comparable -d option.
How it works
awk implicitly loops over lines of input, breaking each line into fields.
-F,
This tells awk to use a comma as the field separator
cmd="date -d \""$1" "$2"\" +%Y/%m/%d"
This creates a string variable, cmd, and contains a date command. I am assuming that you have GNU date.
cmd|getline d
This runs the command and captures the output in variable d.
print d","$3","$4
This prints the output that you asked for.
close(cmd)
This closes the command.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I have a multiple sequence file as
>abc|d017961
sequence1......
>cdf|rhtdm9
sequence2......
>ijm|smthr12
sequence3......
>abc|d011wejr
sequence4......
>stg|eethwe77
sequence5......
I want to edit the file and want the result file as
>abc_ABC__d017961
sequence1......
>cdf_CDF__rhtdm9
sequence2......
>ijm_IJM__smthr12
sequence3......
>abc_ABC__d011wejr
sequence4......
>stg_STG__eethwe77
sequence5......
Thanks!
perl -pe 's/ (\w+) \| /$1_\U$1\E__/x' file
or
perl -lpe '$_ = "$1_\U$1\E__$2" if / (\w+) \| (\w+)/x' file
You can define the input field separator (FS) to be |, the output field separator (OFS) to be _ and then use the toupper() function.
All together:
$ awk 'BEGIN{OFS="_"; FS="\|"}{print $1,toupper($1),OFS,$2}' file
abc_ABC___d017961 sequence1......
cdf_CDF___rhtdm9 sequence2......
ijm_IJM___smthr12 sequence3......
abc_ABC___d011wejr sequence4......
stg_STG___eethwe77 sequence5......
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'm trying to replace a string in a filename:
Original filename:
gamename games.com.zip
Target filename:
gamename.zip
I'm trying to replace the string games.com with an empty string. gamename is not a constant string it can be anything, but games.com is a constant string.
I'd use
mv "$filename" "${filename/ games.com/}"
This is documented under 'Pattern subsitution' in the 'Bash' man-page
Or http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameter-Expansion online
Bash parameter expansion will help:
mv "$f" "${f/ games.com}"
Try the following rename command:
$ filename="gamename games.com.zip"
$ rename " games.com" "" "$filename"
Since the name of your zip file has a space you need to make sure you enclose it in double-quotes.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am facing a problem to convert a document that has the following:
This author {john, #99} said that ...
... bla bla this other author mentioned {barlic, #1508} ...
I would like that vim convert it to :
This author \cite{latexref99} said that ...
... bla bla this other author mentioned \cite{latexref1508} ...
Any idea how to do that ? but also how to revert to :
This author {,#99} said that ... ... bla bla this other author mentioned {, #1508} ..
Convert to:
:%s/{[^#]*#\(\d\+\)}/\\cite{latexref\1}/g
Convert back:
:%s/\\cite{latexref\(\d\+\)}/{,#\1}/g
you dont need a plugin you can use sed:
sed -e 's/{[^}]*\#\([0-9]*\)}/\\cite\{latexref\1\}/g' < file.tex >new_ref.tex
you also can map this to a shortcut in vim
nmap n :%w ! cat % \| sed -e 's/{[^}]*\#\([0-9]*\)}/\\cite\{latexref\1\}/g' > % <CR>