Hi ,
I'm facing a different behaviour with one of my shell script for last few days. It was working good before that.
here is my code for the script FileRemove.sh
execution syntax for FileRemove.sh in my program: sh FileRemove.sh XYZ*.txt
For all my past days first argument passed as my old file which was created one or few days before in the path and second argument passed as a new file created in the path.
For example if I have 2 files as below
XYX20181225.txt
XYZ20181226.txt
then $1 passed as XYX20181225.txt and $2 passed as XYZ20181226.txt for the input argument XYZ*.txt.
But nowadays $2 getting passed as old file and $1 getting passed as new file. Because of this I'm deleting my new file in script instead of old file.
I know this is not the good way of scripting to delete the old file but can anyone advise why it worked all these months fine and suddenly for last one week it is creating issue for me.
I would like to process a list of files matching: GPS*\.xyz with an awk script. I would then like to output the files to GPS*\.xyz.out (e.g. the same file name appended with .out). Something like:
awk '{if(NR==1) {offset=-$1}; $1=$1+offset; print }' GPS*.xyz
this does exactly what I want EXCEPT... (3 Replies)
I am on HP-UX and I am trying to come up with a method to call in a list of files named like so.
filename020107.dat filename020207.dat filename020307.dat
Obviously I can list them ls them like so, ls filename*.dat. In case you did not notice the number is a date and I was hoping to match... (4 Replies)
How can I pass in an argument such as "*.k" to a bash script
without having to double-quote *.k and not having *.k
`glob` to match all files in the pattern?
I tried using noglob in my script but this didn't work the way I thought
it would.. expansion is still occuring, $# is higher than I... (3 Replies)
Hi,
I have a requirement where i need to write a script to create the new file from the given input file with the data in reverse order (bottom to top)
Sample data:
Input File--------------
Java
VB
Oracle
Teradata
Informatica
Output file:-----------------
Informatica
Teradata
Oracle... (3 Replies)
My script(3 arguments $1 = folder,$2 extension,$3 string) should do the following things:
-Enter in the folder of $1(if exists).
-Put ls *.$2 > temp.txt ( I use a temp file to store the result of ls command and if $2 = txt in this file I'll have all the .txt files of the folder)
-Now I want to... (2 Replies)
Hi guys,
Here is a simple script. It writes the current time to specific files in a directory.
The arguments are the names of the files to write the date to (without path nor extension).
root:~# cat /usr/local/bin/dummy.sh
#!/bin/sh -e
for file in $@; do
date >> /var/lib/$file.dat... (11 Replies)
hi guys,
jus some file globbing questions
sed "s/^.*on//"
what does the full stop and asterisk means?
i onli know that ^ means inverse or not (1 Reply)
Hello,
I am trying to replace the position of each row by the next row.
OS: Ubuntu 18.04, bionic
I'd appreciate your help.
input_file:
-O fileA
wget http://x.y.z./a
-O fileB
wget http://a.b.c./d
-O fileC
wget http://q.f.s/t
..
..
..
-O fileZZ
wget http://r.t.y/u
I expect: (6 Replies)