General :: Ovewrite A File In Shell Script?

Dec 12, 2010

I want to overite a file using shell script.

i need to overite the file withe value of 2nd argument.

echo $2 > /home/dir/file.txt whether this will work? or what is the correct syntax?

View 2 Replies


ADVERTISEMENT

General :: Read .gz File Direct On Shell/terminal Without Decompressing The File?

Dec 9, 2008

How can I read .gz file direct on shell/terminal without decompressing the file?
satimis

View 5 Replies View Related

General :: Shell Script That Adds Users Name To A File When The File Is Modified?

Mar 30, 2010

I need a shell script that will add the users name and date to a file when the user has modified the file, these files are within a group and only accessible to this group. But we need a way for people in the group to know who and when the file was last modified.

View 1 Replies View Related

General :: Convert Binary File In To Ascii File Using Shell Script?

May 23, 2011

i am trying to convert a binary file in to ASCII using shell script. this file contains multiple types of data like string, number, bcd, etc.

View 5 Replies View Related

General :: Printing From Bash Shell / Concatenate Files Into One File With File Names Included?

May 11, 2011

I am supposed to take some small files, and print them to a specific printer, such that the small files are concatenated into one file. The file name has to be included in the file that gets printed.

Should I be looking to concatenate the files into one file with the file names included, and then print them?

something like: -printfunction -printername < file*

View 7 Replies View Related

General :: Shell: Script On Each Line In A File

Jan 3, 2011

So if I have a file with a list of files:

file.txt
file1.a
file2.b
file3.c

and I wanted to perform a script using a loop or recursively on each of those files, is there any way that I could do this?

I saw that xargs might be able to help me.

Here is sorta what I want to do:

Code:
#!/bin/bash

cat file.txt | xargs?? # Some commands to turn each line into a variable

for var in ${@}; do # Some way to get each of the files

# script on each file

View 1 Replies View Related

General :: Quickest Way To Share File From Shell

Jul 30, 2010

I'm using Ubuntu minimal install (With no window manager). What is the quickest and easiest way to upload a file somewhere? Something like a script to pastebin would work.

View 2 Replies View Related

General :: (Shell Script) Choose Log File To Use

May 9, 2011

I have a small script that uses the find command to look for a log file named: backup_log.txt. And then uses the first value in the log file as a variable in the script later on. However, say there are two or more of these log files located in different directories, how would I let the user choose which log file will be the one to use, and then make that (fullpathtofile) the value of the variable that will be used.

View 5 Replies View Related

General :: Shell Scripting - For Each File In Directory

May 2, 2011

I am working on some homework, however i am not here to be spoon fed. I am trying to get the numerical modification date of each file in a folder. Ie lets say there is a file called bob and it was modified 2006-11-23. i want to get it into a variable as 20061123.

Now i currently have this code:

Code:

However for some reason my output is:

Quote:

See how the 2011 has been placed next to it? i ran it with -x and saw this:

Code:

However i do not know how to find a way around this?

View 11 Replies View Related

General :: Convert DOS Bat File To Shell Script?

Jun 21, 2010

I need to convert the following .bat file to a linux shell script.experienced and kind linux folks:

:: Import database schema
echo off
echo.

[code]....

View 2 Replies View Related

General :: Insert Texts In A File By Using Shell?

Jan 26, 2011

I'm using fedora 14...i would like to insert few texts to a file in shell prompt(may be useful in scripting for in the future)...for eg,

[root@ruby ~]# cat > hello
1
2
2

[code]....

so in the above file i need to add the line "new line added" near the number 4 in the above file ....how can be this done ...?

View 8 Replies View Related

General :: Shell Command To Display Contents Of A File?

Feb 23, 2010

shell command to display contents of a file? Like that of .txt or .html

View 9 Replies View Related

General :: Get The Shortest String In A Text File With Shell?

Apr 29, 2010

Assume I have a text file as belowabcdaaaaaaagfgkhahahahahahhahhgfThen gf would be returned

View 4 Replies View Related

General :: Find The Tag Value In Xml File Through Unix Shell Script?

Nov 3, 2010

the below tag is in the xml file. Now i want to find and extract the value of application name test1 and test2 one by one in the unix shell script. how to do this

<application name="test1">
</application>
<application name="test2">

[code]...

View 2 Replies View Related

General :: How To Look At History File In Unix Shell For User?

May 28, 2010

How to Look at history file in unix shell for a user, find 5 most often used commands.

View 5 Replies View Related

General :: Can't Source File By Shell Script In Ubuntu 10.04

Jul 30, 2010

When I try to execute my script its getting error

.........................................
tape_restore.sh: 40: source: not found
tape_restore.sh: 41: source: not found
tape_restore.sh: 42: source: not found
.................................

But in Redhat I can run same script . My script as follows.

**************************************************
SCRIPT_HOME=/home/dhanushka/project/mChoise_Recharge/scripts/scriptfw
TAPE_DRV=/dev/st0

[code]....

View 4 Replies View Related

General :: How To Modify Line Of File Using Shell Script?

Apr 12, 2010

I have a file like below
n
p
1
1
50
w

I need to modify the first occurence of 1 byt some other integer.How do i do it using shell script?Can anybode help me out with that?

View 9 Replies View Related

General :: Pass File Content Through URL Using Shell Script?

Jul 16, 2011

I am calling a URL from shell script and passing few argumants,Here i have to pass file content as one argument.How can i pass file content through URL.

eg:
content=`cat /Users/test1.txt`
open http://localhost:8080?filecontent=$content

[code],...

View 1 Replies View Related

General :: Need To Convert Batch File To Shell Script

May 3, 2010

Kindly help me converting a batch file with following commands into shell script..I would like to have the same functionality with shell commands.

View 2 Replies View Related

General :: Shell Script For Appending Data To A File?

Feb 8, 2011

this is how we append a file at command line its like

cat>>file.txt
adasds
^D

but how to write the code for appending a file in a shell script i tried but its not running

cho "the contents of the file before appending"
cat ab.txt
echo `cat >> ab.txt

[code]....

View 3 Replies View Related

General :: Shell Script That Reads From Parameters File?

Nov 3, 2009

what I am trying to do but I am not sure exactly how to do it. I want to write a shell script that will replace certain values in a file with environment specific information that it pulls from a parameters file. The paramaters file looks like the following...

[dev]
ip=10.15.109.41
name=dev1.mydomain.com

[code]...

View 4 Replies View Related

General :: Shell Script To Find A File Size?

Jul 20, 2010

am trying to write a shell script to find the size of a particular log file and if the log size grows, script should mail the changes to the administrator or a any user so script should monitor the log file continuously in a time interval, how can i do that?

I tried with these codes to find the file size but it throws me error says command not found

$s=$( stat -c %s mylogfile.log)
echo $s

View 10 Replies View Related

General :: Shell Scripting Text File Creation ?

Feb 16, 2011

I'm just starting out with shell-scripting, but having a problem with making new text files with the touch or cat > commands.

What I've been doing is touch testfile1.txt

Also, I've tried cat > testfile1.txt (text)

Console reports "bash: text1.txt: No such file or directory. Consfusingly, it works fine in the home-directory. But if I move the file to where I want it, I can no longer view, edit, etc. it.

View 1 Replies View Related

General :: Modify A File Like /etc/gdm/custom.conf From The Shell Or A Script?

Jun 22, 2010

I want to modify a file like /etc/gdm/custom.conf from the shell or a script.

# GDM configuration storage
[xdmcp]
[debug]
[daemon]
AutomaticLoginEnable=true;
AutomaticLogin=username;

But the idea is that I can add a line to a section and it check if the section is defined, (add the definition if not), the property is defined, let it undefine (erase the line), (and delete the section header if there is no property defined), etc...

I didn't find anything except gconftool-2 but it do not explain how to modify other files. (there is a shema file there).

there isn't a program/script to achieve this, but can easyly be made for every config file, If someone do something like that, with a little database of which markup use each file, it could become really popular.

View 3 Replies View Related

General :: Shell Command To Find Newest File In Filesystem?

Apr 13, 2010

I'm relatively experienced with UNIX and Linux, but this has me thrown for quite a loop, and it seemed like such a simple question. How would I go about finding the newest file in a file system? I thought something like:

Code:

ls -ltr `find /usr -type f`

would work, but I seem to be exceeding the argument maximum for ls:

ksh: 0403-029 There is not enough memory available now

I thought something involving xargs might work, but I really suck with that command.

View 3 Replies View Related

General :: Shell Script To Import .exp File To Oracle From Cronjob?

Nov 18, 2010

I am trying to import .exp file to oracle database. I have written a script for the same, but i am able to run it manually with out any errors , but it failing from cronjob(Even though i am using absolute path every where) Follwoing is the command i am trying to execute from shell.

/opt/ORACLE/product/bin/imp test/test@testdb full=y ignore=y buffer=1000 log=/data01/import_all.log file=/data01/test.exp

View 2 Replies View Related

General :: Delete A File On A Remote Server Using Shell Scripting?

Jul 18, 2010

delete a file on a remote server using shell scripting.

View 14 Replies View Related

General :: Determine Number Of Rows And Columns Of File In Shell?

Mar 4, 2010

if there's a tab-delimited file under /usr/desktop, how can I determine the number of rows and columns of the file in shell?And, if told the the 3rd column of the file contains only numerical values and all values in the 5th column are unique, how can I verify these in shell?

View 13 Replies View Related

General :: Shell Script File - Pass Multiple Parameters To Interpreter?

Feb 2, 2011

I have a Python script that I run which needs to execute under a special environment, so I would run the program like so from my working directory (~/project/src):

python manage.py shell

This opens up an interactive shell for me to start typing my own commands.I have another set of administrative activities that I would like to house in another directory (~/project/admin). The manage.py is really finicky about running from the working directory. So, to make this whole thing work, I made a script which starts off like so:

#!/usr/bin/python ../src/manage.py shell

There are a couple problems with this. The first is that it doesn't work:

/usr/bin/python: can't open file '"/../src/manage.py" shell': [Errno 2] No such file or directory

How do you specify multiple parameters to the interpreter?How do I change the working directory?

View 2 Replies View Related

General :: Shell Scripting: Inserting Text Into A File Name With A Predictable Pattern

Apr 18, 2011

Just using shell scripting, how can I insert text into the middle of a file name. The file has a predictable pattern, let's say 3 letters and 3 numbers and I want to insert text in the middle of those 2 patterns. Say ABC123 is the file name. As a result, the file name should be ABC.blah.123

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved