Ubuntu :: Matching And Returning A Part Of File Name On Bash?

Apr 25, 2011

If I have files named like this:

abc_one.c
egx_two.c
tsf_two.c

[code]...

View 9 Replies


ADVERTISEMENT

Programming :: Bash File Comparing - Report How Many Matching Words My Main File ?

Jun 9, 2009

I have been messing with diff and grep for 2 days now without result

I am trying to match a file consisting of words to many separate other wordfiles in a specific directory. one by one.

What i want the script to do is to report how many matching words my main file has with every file in the directory, each in turn

setup:

Each of em are plain text files with 1 word per line

Output should be something like:

SCRIPT REPORT:

View 8 Replies View Related

Ubuntu :: Bash - Delete First File Matching Regex?

Mar 27, 2011

In a bash shell script, I want to do something like this:

Code:
if [[ $(ls -ld /some/dir/foo_* | wc -l) -gt 4 ]]; then
rm -rf first_match_of /some/dir/foo_*

[code]....

View 6 Replies View Related

General :: List Files Based On Matching Only Part Of Their Filename?

Sep 13, 2011

I have many files in a folder for example

Kiran.txt
Kiran1.txt
Kiran221.txt
Kiran144.txt
Time.csv

[Code]...

From this directory, I want to know how I could use grep to display files based on part of their filename - for example those starting with "Account" or those ending in ".sh".

View 4 Replies View Related

Ubuntu :: Returning To A Menu In Bash Script?

Feb 7, 2011

Im constructing a menu for a program using case. I have all my normal input options mapped out but i want to have a * ) option so that if something else is inputed, it displays "Incorrect input" and then resumes the normal menu function. How do I do this? Ideally, I'd like it to display "Incorrect Input" and then accept more input for the menu.

View 2 Replies View Related

General :: Bash Catching The Function Returning Value Into A Variable?

Mar 17, 2010

i am dealing with this problemI have a function

function Une {
...
return $some_variable

[code]...

View 6 Replies View Related

Programming :: Simple Bash Script Not Returning Correct Value?

Sep 14, 2010

I have a very simple bash script:echo -n Create home directory?:

read HOMEDIR
if [ $homedir="y" ] || [ $homedir="yes" ]; then
homeval=" --makehomedir"

[code]...

View 6 Replies View Related

Programming :: ! For Not Matching Bash Regex?

Jan 13, 2011

In a bash-script, only the case if a regular expression does not match is relevant.herefore I used the exclamation mark !. But where to place it?

These two work fine, but are they equivalent?
Code: if ! [[ $abc =~ $pattern ]]; then or
Code: if [[ ! $abc =~ $pattern ]]; then Where is the ! placed more correct?

View 2 Replies View Related

General :: How To Get List Of Files Not Matching Patterns In Bash

May 4, 2011

I have a file with joker character patterns:
./include/*
./src/*
etc.
From the current directory I would like to recursively get the list of files that do not match these patterns.

View 2 Replies View Related

General :: Get Part Of A String In Bash ?

Mar 10, 2011

I've a string "this.is.a.name", and I would like to return "is.a.name". How can I do that in bash?

View 3 Replies View Related

General :: Run Part Of A Bash Script From Within Another?

May 4, 2010

I have two scripts, one of which is very long (around 11000 lines), and i need to run this two lines at a time within the other script. Is there any way to do this?

View 2 Replies View Related

General :: Return Part Of A String In Bash?

Mar 20, 2011

I would like to return the last part of a string in an array of strings in bash.

The array contains in each position the content below:

Code:
a.b.c
a.d.f
a
a.d

[Code].....

View 5 Replies View Related

Programming :: Matching Two Tables Of Non-matching Sizes?

Mar 2, 2011

I have two table files with x (1st column) ,y (2nd column) coordinates and intensity (3rd column). I need to match these two tables and divide the intensities at the consecutive coordinates on the 3rd column. The problem is the size of the tables are not same and I want to ignore the lines if they are not in one of the other file.

Here is Table 1:

Code:
-7.500-30.00013.006
-7.500-22.50037.952
-7.500-15.00060.962
-7.500-7.50040.922
-7.5000.00014.348
code....

View 3 Replies View Related

General :: Bash Script Is Reprinting Part Of A Field From An Awk Statement?

Apr 21, 2010

Here's the bash script:

Code:

FILES="/usr/sbin/accept
/usr/sbin/pwck
/usr/sbin/chroot
/usr/bin/fakefile

[code]....

Notice the extra" file size" lines in there? What's causing that? I'm trying to learn more bash skills. I have no experience with awk because I have been unable to understand it's basic necessity. But I thought maybe if I try it with some test scripts I might become more interested in using it more and expand my very limited capabilities.

View 13 Replies View Related

Ubuntu :: Move A File Matching *.ext Regardless Of Case

Jan 26, 2010

how I can use the mv command to move a file that matches *.ext regardless of the case?

I would like to be able to move:

*.ext
*.EXT
*.ExT

....and so on with a single command. I do not want to have to type out all combinations of this single file extension in my script because my file system is case sensitive.

View 9 Replies View Related

Ubuntu :: Rename A File Then The Entire File Is Selected And Not Only The First Part?

Feb 13, 2011

I'm using Ubuntu for about a half year. Currently version 10.10. The next problem I have with Nautilus: He have it in ListView. If I want to rename a file then the entire file is selected and not only the first part. So the file extension is also selected. I think this is a bug, whoich can be found on the Internet, but I do not find a solution. Does anyone here have a solution?

View 4 Replies View Related

General :: File Matching Pattern On Command Line?

Sep 9, 2011

I've got files in a directory as follows:

1.png
1_thumb.png
1-1.png
1-1_thumb.png

[code]....

I want to list all the files that don't have a copy with the same filename with -1 somewhere in it. So, in the example above, the results would be 3.png.

NB: the file and its copy with "-1" in it will be the same filesize, if that helps.

View 2 Replies View Related

Programming :: Delete Line In File Matching String?

Jan 26, 2010

Quote:Originally Posted by topcatI would like to know how i can write a shell script to delete a line if a particular pattern exists?E.g. I have a text file with multiple lines. Say 1000s. in the following pattern.

username@email.com:149.0.3.4:1
username1@email.com:149.0.3.4:1
username1@email.net:149.0.3.4:1
username1@email.edu:149.0.3.4:1

If the patternusername@email.com exists then the line "username@email.com:149.0.3.4:1 should be deleted from the file.I have a very similar question but I need to delete one line in a file which matches one very precise instance of a string only. Let's assume I have a file composed of thousands of lines and let's call the file chap-secrets. Let's take the following sample entries:

Code:
#USERNAME SERVER PASSWORD IP
pp pptpd blahblah *

[code]....

View 7 Replies View Related

Programming :: Script To Copy Paste Text From One File To Another (overwriting Part Of The File)?

Apr 19, 2011

I have a .txt-file with ~50.000 lines of numbers, generated by a mathematics program. From this file, I need line ~ 1.100 to line ~16.000 (these lines are always the same btw, this may make the solution easier, dunno) to be copy/pasted to another file, where the lines ~500 to ~15.000 (also, every time the same) should be overwritten by the aforementioned lines...I haven't found or come up with anything that works yet, mostly I find solutions to copy everything from one file to another but I can't find something to specifically overwrite a part of a file with part of another.

View 4 Replies View Related

Ubuntu Installation :: After Dd From Full 15GB Part To 1.3TB Part, Shows Same Free Space?

Dec 8, 2010

I just used dd to clone a linux partition to a new hard drive, it had 800mb left on the old hard drive, after dd, new hard drive lists 1.29/1.3 terabytes full. Is this what happens by default in dd? How can I fix this?

View 1 Replies View Related

Server :: How To Access Local Part / Domain Part Of Email Address In Postfix's Main.cf?

May 24, 2010

I'm trying to figure out how to access the local part and the domain part of an email address in postfix's main.cf. For example, myname@mydomain.net has myname as the local part and mydomain.net as the domain part.I get the whole email address with %s. I want to speed up the lookups by writing better database queries.I've had no luck finding this in the otherwise well documented postfix.

View 2 Replies View Related

Ubuntu :: Downloading A Part Of A File?

Nov 2, 2010

I know that the question could sound weird but...I was wondering if is possible to download one or more parts of a file.

For example, the first 10 mb, or the latter ones.

I know that there are some apps that let you do segmented downloads, but, is there anyone that let you choose the segment to be downloaded? If not, can this be accomplished with any linux command-line application?

View 4 Replies View Related

Software :: Server Hosting Different Part Of Web Site Must Appear As Part Of Domain

Jul 13, 2009

we have access to one domain name , 1 internet ip address and may servers hosting different part of site. I want them all to be accessed via same web site . some of the server in our network are embedded devices.they have their specific utility being hosted on that machine. So the severs are bound to be distributed . I just wanted to know how can I access them via single ip, domain name.

View 6 Replies View Related

Ubuntu :: Download Only The Missing Part Of The File?

Aug 14, 2011

I downloaded a .gz file. The network was disconnected a few times during downloading. I resumed the download each time with wget -c option. However after all the downloading is over, an error occurs when I try to extract the .gz file. Is there any way I can download only the missing part of the file?

View 1 Replies View Related

Hardware :: Is CMOSRAM Is Part On Mother Board Or Part Of RAM?

Jan 14, 2010

In bootseqence of linux, the first step is check the CMOSRAM(size 64bytes) setup for custmor setting. So i am just confused wether CMOSRAM is a part of motherboard or is a part of RAM itself.

View 4 Replies View Related

Ubuntu :: Packages Part Of Iso Image File Installation

Feb 24, 2010

When I look in /var/cache/apt/archives/, I see packages I recognize that I downloaded. But, I also see packages that I know I did not download, but rather were part of the initial installation of the image iso file on the CD. For example, the package for Abiword is in there. I would like to know which packages in this directory I installed, and which were part of the initial installation.

How do I know which packages are part of the installation from the image iso file on the CD? Once I know that, I would make a copy of all the other packages in this folder onto a DVD, so if I ever need to reinstall Ubuntu 9.10 I will know which packages to install over and above those part of the initial installation off the iso CD.

View 5 Replies View Related

General :: Dowload One Part Of A File From Web?

Aug 19, 2010

lets say there is one very big file on some server and i just want to download first 1MB. How can I do it on Linux ?

View 2 Replies View Related

Programming :: Extract Part Of File Name?

Mar 26, 2010

I have this string ./DAT000728-652523058.job.I want to extract the no between DAT and - sign. I want 728. I dont want 000728.echo ./DAT000725-560162365.job | cut -d'T' -f2 | cut -d'-' -f1 I am getting 000728.string can be ./DAT326822-652523058.job also. then i need 326822

View 6 Replies View Related

Programming :: Replace Part Of A File With Another?

Jan 8, 2010

There are a few things I was wondering about (using tools available in bash):How to insert a file at at the specified location of another.How to copy a portion of a file between two lines matching a regex to another file (and/or making sed only work between two lines matching a regex)How would you do this?

View 2 Replies View Related

Ubuntu :: Make A Executable File Part Of The System Path?

Sep 1, 2010

Morning all , not sure how to put this. I have a .sh executable script I use for video encoding. I want the system to be able to see it no matter where in which folder I am. I want to be able to execute that script in terminal in any folder. How can I make it part of the system path. ? Don't know if my wording is right but I think you guys know what I mean.

View 9 Replies View Related







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