General :: Create Files For Specific Output?
Mar 10, 2011
I would like to create a bash script that takes the following text and split in different files. The output is:
Code:
JOB ID: 1
JOB NAME: Test1
01012010 Message: Success1
01012010 Message: Success2
[Code]....
View 7 Replies
ADVERTISEMENT
May 5, 2010
I need to create a report ,
The data is spread across two files in below format,
File 1
=========
<Class Name1>
Ph: 001
Place: place001
</class>
[Code]....
View 4 Replies
View Related
Jun 29, 2010
I'd like to create a tar file on my machine to distribute software to other machines which are all alike (including, usernames, groupnames, etc). I need to create certain files and directories with specific owners on the target machine. In order to do that, I use
Code:
tar --create --owner=someone --group=somegroup --file package.tar files. However, for this to work, someone must be in my /etc/passwd and somegroup must be in my /etc/group. Is there a way to fake this so I don't have to create a bunch of users only for that purpose?
View 3 Replies
View Related
Dec 7, 2010
I've a program which manages my pdf and references. I wish to put some of the information on my website but that program (Mendeley) does export only in XML (or bibtex). I'd like to simply convert the XML output files to SQL in order to create or update an SQL database.I'm not an expert in either XML or SQL (use only PHPMyadmin). Does someone get help me to figure out?
View 2 Replies
View Related
Apr 23, 2010
Consider a situation in which you want to display only specific lines of contents from a file or of a command's output. Yes, we have head and tail commands. But, how to view all the lines of a file except the last one or vise versa when we don't know the count of lines in advance?
Consider this output:
Code:
[root@localhost ~]# ps au | grep bash
root 6316 0.0 0.0 4672 1440 tty1 Ss+ Apr22 0:02 -bash
root 20847 0.2 0.0 4672 1432 pts/0 Ss Apr23 0:12 -bash
root 21167 0.0 0.0 3920 660 pts/0 S+ 01:00 0:00 grep bash
Here, I don't want the last line (in italic) to be included in the result since the last line is due to "grep bash" in the devised command "ps au | grep bash". Well, we can rewrite the devised command:
Quote:
"ps au | grep bash | head -n 2"
But, again, here we are specifying the count of lines to be included. But, in the presented problem we don't know any count in advance!
View 6 Replies
View Related
May 19, 2010
I need to know the version number of tar used to create a specific tar file. How can I do that?
View 1 Replies
View Related
Aug 1, 2011
It should not have any /home/. It only can access a folder and that folder is home default for this account.
Details about my usage: We have a simple folder which contains demo code and we want to create a user to read this folder only
View 2 Replies
View Related
Jul 24, 2010
I need to search a bunch of files in a specific folder for a specific number and add all the numbers together to a total sum. I use Rsync everyday, everytime I run rsync i get a logfile (rsync output) witch contains the textstring "Total bytes sent: xxxxxx".
The "xxxxx" can vary in lenght. I need to extract the "xxxxxx" from each file and add the numbers together to a total size over a week or a month. Is this possible? And I wish to only use bash. One way of doing stuff at a time my friends .
View 5 Replies
View Related
Feb 3, 2010
I need to create a single line of output from multiple and variable lines of input in a Linux bash shell script.
My input file looks like this:
Where there may be any number of umsecondaryphonenumber lines; if there is not a umsecondaryphonenumber line for a telephonenumber, I don't want to write any output.
So, the output file should look like:
The script I have so far is:
My question is - how do print each of the elements of an array in one record - i.e. what do I put in place of howdoiprintarray?
View 2 Replies
View Related
Dec 2, 2010
How can I search files modified in a specific day?
View 2 Replies
View Related
Feb 17, 2010
How can you remove files containing a specific string?I have...Code:find |grep 'string'This may return several results and I wanted to rm the results.I also have...Code:ls -l |grep 'string'|awk '{print $9}'which also may return results.But point is, I can't supply the results as a parameter to rmI was thinking of looping but I don't know how to access the results as if they were an array or something.
View 5 Replies
View Related
Jul 20, 2011
sudo cp ../../../rootfs_maker_ramdisk drivers/filesystem/ -rf
give below errorCode:cp: cannot create special file ...._rootfs/dev/hda4': No such device or addressi get this error only in some specific locationsif i dont use sudo then i get permission denied msg
View 4 Replies
View Related
Dec 24, 2010
I am trying to use the command gzip to compress a directory or file list as argument and compress the file in a file named copia101225, within a directory named ZIPFILES. I want to make sure that if the arguments doesn't exist, the destination directory doesn't exist that it creates it. I keep failing at compressing the file to copia101225, that is within the directory named ZIPFILES This is what I have so far:
#! / bin / bash
# Title: Compress a file
# Author: Jose Miguel Colella
# Description: Compress a file
[code]....
View 14 Replies
View Related
Jul 26, 2011
I just installed 11.04 on my PC. I use my TV as my monitor because I use this machine to stream from Hulu, Netflicks or Icefilms. Ubuntu does not detect the resolution I want to use, which is 1152x648. An odd ball res I know, but everything fits best on that setting and I'm not concerned with HD.
This is what I've tried so far:
I then tried:
Then:
I checked my work by entering xrandr and the mode I added was in the s video settings but not available for the DVI-0 monitor.
How would I go about adding this resolution to the DVI-0 output?
Below I pasted what prints out when I input xrandr...not sure if diagnose my error.
View 1 Replies
View Related
Jun 22, 2009
I'm trying to find all zip files timestamped from the past 7 days, then unzip them into a different director.I tried the following, but it only unzipped one of three files that meet the 7 day criteria. What am I missing?Code:find /home/user/public_html/zip_files/ -iname "*.zip" -mtime -7 -print0 | xargs -n10 unzip -LL -o -d /home/user/public_html/another_directory/
View 1 Replies
View Related
Jan 31, 2011
I have word like initialize_my_var:in sample.php and I included three library files, take it as a.php, b.php, c.php ,I really don't know where my label(initialize_my_var:)definition is present in my library files, is it possible with a pattern matching string to find which library file really have the exact term "initialize_my_var:" , I'm really looking for an exact pattern match.
View 1 Replies
View Related
May 26, 2011
I wanna copy all folders and files created from 01.01.2011 until today to new placeie:cp -r /home/moviecar/public_html/wp-content/uploads/ /home/teaser/public_html/wp-content/uploads
View 4 Replies
View Related
Mar 4, 2011
I would like to be able to recursively delete specific various files from a directory and sub-directories. For example:
Dir/
|_sub1/
|
|_ _rm *file1 *file2 *file3
[code]....
View 11 Replies
View Related
Jun 14, 2010
I have an application that creates temp files and quickly deletes them. But I'd like to keep those files, is there a way to do that in Linux?
View 2 Replies
View Related
Jan 18, 2011
How do I recursively generate a text file which has a list of all files on my server which contain a specific string anywhere in the files?
I know the following command can be used to replace a string recursively
find /var/www -type f -print0 | xargs -0 sed -i 's/old string/new string/g'
I do not want to replace the string, I just want a list of all files which contain the string.
View 4 Replies
View Related
Apr 7, 2011
I am trying to write a simple back up script in python where I try to list the files that are 24 hours old in specific directories that I would choose.I read the manual of find and used
find . -mtime 1 > log.dat
to get the list of files in the log.dat however I also get the path information in that list as such
./hpc06MatlabCodes/2011/Apr/3dBoxModel
./hpc06MatlabCodes/2011/Apr/3dBoxModel/vfluidIrca10.dat
./hpc06MatlabCodes/2011/Apr/3dBoxModel/vLRecoveredSystem.mat
is there a way to exclude the directories and only get the files list.
View 2 Replies
View Related
Jul 19, 2011
I would like to overwrite files in a directory tree, recursively. The ones I would like to overwrite match the filename "x_alpha*.png" and have a size exactly 456 bytes. Is there any way to search for these recursively in a directory tree, and overwrite them with a reference file, for example "e:mydirgood.png"
I am using Windows 7, but I have UnxUtils, so I can use those too. What I am looking for is something like this, generated automatically:
copy /y e:mydirgood.png e:mydiracx_alpha0023.png
copy /y e:mydirgood.png e:mydirefgx_alpha0045.png
copy /y e:mydirgood.png e:mydirhx_alpha0248.png
View 2 Replies
View Related
Apr 18, 2011
I need little help. I want to find all files with extension "*.tar" "*.gz" and "*.zip" and move all those files into "/opt/old" directory. I've tried this command:
Quote:
find . -type f -name "*.tar" "*.gz" "*.zip" -print0 | xargs -0 -r mv /opt/test
It's not working, something wrong after "mv" i guess.
View 10 Replies
View Related
Aug 21, 2010
I am using secure delete to remove files from a Debian Linux PC. However, secure delete does not remove folders. This has lead me to look at writing a script that would move files to a predetermined folder for deletion. My plan is as follows:I have a folder on my desktop called shredder where I move the contents of the waste bin to. The script needs to identify all files within the folders and sub folders, within the shredder folder, and move each file to the shredder folder and then delete the folder. At this point secure delete can be used with a command like shred -v -u *.*on the shredder folder.The problem I have is in creating the code to move files from the different folders and then deleting the folders. Note that the names of the files, folders and subfolders will not always be known
View 12 Replies
View Related
Nov 20, 2010
I am a member of a group which has written a program whose source code is being held in a specific directory (~cs252/Assignments/basicAsst/project) and we want to go through and change the parameters for the function "sequentialInsert." My job is to find all occurances of the function call to "sequentialInsert" and to also list the files from where the code came from. Also, I have to be in the commandsAsst directory when I do this. I have tried grep and find combined together, and I am at a lost.
View 1 Replies
View Related
Jul 22, 2011
suppose in my current directory, I have 50 sub-directories. Now, I am interested only in about 20 of those sub-directories (whose names match a pattern). I would like to recursively list the contents of these 20 sub-directories. How do I do that ? I would like to do this in Solaris 10 and Linux(RHEL 5.x).
View 3 Replies
View Related
Jan 26, 2011
I am using CentOS 5.5 and I created few users (useradd john etc.) and now I want to assign privileges to this user on some directories and files in those directories. For example I want to give read privileges to directory "/documents" and all of files under that directory.
View 13 Replies
View Related
Nov 16, 2010
Terribly new to Linux and find it mindboggling. I work on brain imaging and unfortunately all of the analysis runs on Linux, and I do not understand computers well coming as I do from a medical background. So my question - There are various folders of patient MRI scans (folders called P1, P2, P3 etc) and within them are enclosed certain files that I am interested in (always called the same name in all folders, say image001). I would like a script that enables me to copy and move this image001 in all these individual folders to another folder altogether.
View 13 Replies
View Related
May 10, 2011
I am trying - to no avail - to take an old script I found in the forum help-needed-in-grep-for-tar-gz-658730/ The code:
Code:
#!/bin/bash
if zgrep $1 $2 > /dev/null 2>&1
[code]....
View 3 Replies
View Related
Nov 6, 2009
In a couple days I plan on changing to opensuse from kubuntu. Anyway in the Kpackagemanager I removed the pulseaudio client (and its dependencies) and it messed up my system a bit. I don't really mind but all I need is to get my files from my home folder off my hdd to an external through usb 2.0. When Kubuntu 9.10 boots now all it is is a command terminal basically and I don't know the specific commands to get the files. Or if I need to reinstall something so that it boots up with a graphical looking UI again.
View 14 Replies
View Related