08-21-2013
sed if statement to see if file exists
Is there an easy way of checking for the existence of a file that ends with the extension .order and if it exists do something? if not do nothing
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
this is my output for my crawler.
/about.html
/ads/
/advanced_search?hl=en
froogle.google.com/frghp?hl=en&tab=wf&ie=UTF-8
groups.google.com/grphp?hl=en&tab=wg&ie=UTF-8
/imghp?hl=en&tab=wi&ie=UTF-8
/intl/en/options/
/language_tools?hl=en
/maphp?hl=en&tab=wl&ie=UTF-8... (3 Replies)
Discussion started by: chris1234
3 Replies
2. Shell Programming and Scripting
I am just wondering if it's possible to refer to variables within a sed statement as follows:-
cat $file | sed -e 1's/$oldtext/$newtext/' > $file
as when I run the script, the variables are not recognised and nothing happens..??
Thanks (5 Replies)
Discussion started by: sirtrancealot
5 Replies
3. Shell Programming and Scripting
Hi,
I'm trying to write a bit of code that will check if a file exists and then archives the file
Im trying to use the following if statement without success..
if
then
mv filename archive/filename
else
echo "no filename exists"
fi
Should the file name be... (3 Replies)
Discussion started by: Jazmania
3 Replies
4. Shell Programming and Scripting
Hi All,
If i run below copy command, it works absolutely fine,
/opt/csw/bin/scp axetlxyz01:/opt/data/test/QURIES* ./input
I want to make the above line better, by adding an IF statement, want to check if there is any file exists with name QURIES*.* then i need to copy that.
if
... (7 Replies)
Discussion started by: rkrgarlapati
7 Replies
5. UNIX for Dummies Questions & Answers
I need to check if an entry input by the user is in a file. If so, I need to run a command, and if it does not exist then it should output entry does not exist.
So I have so far...
echo "Enter record:"
read record
//command || //command
Can I use an if statement to do this? (3 Replies)
Discussion started by: itech4814
3 Replies
6. Shell Programming and Scripting
Hi
#Testing for file existence
if ; then
echo 'SCHOOL data is available for processing'
else
echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING'
:
i wrote a script, where it begins by checking if file exists or not.
If it exists, it truncates the database... (2 Replies)
Discussion started by: rxg
2 Replies
7. Shell Programming and Scripting
Hello Guys,
I am new here and this is my first post, hope someone can help me
I am writing a script that is supposed to go in 9 different directories and edit a given file in each of the directories. I am using sed to edit the file as
sed -i 'line# s/#to be changed/#to be replaced with/... (5 Replies)
Discussion started by: Madiouma Ndiaye
5 Replies
8. Shell Programming and Scripting
Hi,
I have a file with data listed below:
clm_id double,
cnl_id double,
cnl_amt double
I want output to be
clm_id string,
cnl_id string,
cnl_amt double
So replace double by string if the field contains the word _id
I tried
sed -e 's/_id/& string/' filename
The above will not... (2 Replies)
Discussion started by: wahi80
2 Replies
9. Shell Programming and Scripting
Hi folks,
I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex.
I have a bunch of update statements with all columns in a file which I need to convert into insert statements.
UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies
10. Shell Programming and Scripting
input
| Jan 8 2018 11:28PM| 24 | 75 | 51 | 1 | 1.600|
| Jan 8 2018 12:01PM| 52 | 823 | 21 | 6 | 2.675|
desired output
Jan-8-2018-11:28PM 24 75 51 1 1.600
Jan-8-2018-12:01PM 52 823 21 6 2.675
Dear friends,
I have input file , as shown above and... (10 Replies)
Discussion started by: sagar_1986
10 Replies