Ubuntu Servers :: Terminal Command - Searching Given SH File For String
Mar 10, 2010
I need a hand with a line of terminal commands. I need to be able to search a given .sh file in a given location for a string, and when found, add a "#" to the start of that string and save the file back to it's original location.
View 1 Replies
ADVERTISEMENT
Jan 18, 2011
I am using grep command to search in a particular file whose size is 11 GB and i am getting Segmentation fault error as an output. My command and output is as follows:
Code:
[sdpuser@gnnsdp40 test]$ cat new* | grep 8858406465
Segmentation fault
My linux version is as follows:
Code:
[sdpuser@gnnsdp40 test]$ uname -a Linux gnnsdp40 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
how i can parse the complete file for searching string. I have also used split command of linux which splits the file of 11 GB to 11 files of 1 GB each respectively. But still getting the same "Segmentation fault" error while using grep.
View 9 Replies
View Related
May 18, 2010
I have a file which provide the output of all the applications which started and running successfully. But it doesn't give the Error message of the applications which are failed. For example there are 5 applications (ABC,DEF,NMO,STO,XYZ) and application STO failed so I will get the following output (out.txt). content of out.txt file
Application ABC is Running
Application DEF is Running
Application NMO is Running
Application XYZ is Running
I want to generate the text message based on the information on out.txt that STO application is Failed.
View 2 Replies
View Related
Oct 14, 2010
I want to be able to check the contents of a text file for a specific string and remove it from the file from the command prompt. I would basically be searching through a number of files and if a specific string is found I would like it removed automatically. pretty much a find and replace, were the replace is nothing. any one got any ideas on how you would do this. I already have the search part sorted just need to be able to remove the string I don't want from the multiple files.
View 4 Replies
View Related
Mar 3, 2011
Is it possible to search ALL files on a system for a specific text string? I've been messing around with grep without any luck.
View 2 Replies
View Related
Jun 27, 2011
I just want to know if we can search for a particular string in all files of a particular folder in linux. if a folder has 100files only that hundred files needs to be checked for a particular string.
View 5 Replies
View Related
Oct 27, 2010
I need sed to be able to search a string that includes both single quotes (') and double quotes ("). can anyone help me out, there has to be a way to do this.
So far I have tried:
But none of these work and I cannot think of how else to escape the sed quote inside of brackets.
View 3 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
Mar 31, 2010
I am not especially cli adept so could someone tell me the best way to use the diff command to get the difference between a string of text and the contents of a file instead of between the contents of two files?
View 3 Replies
View Related
May 3, 2011
I've been trying to understand pthread in C a little better. So I made a simple program that takes in a string from the command line and creates a thread to print the string. I've looked online and copied the basic concepts but there are something things I'm confused about. The programs works just fine, but I have questions. Here's what I have so far.
[Code]....
One thing I'd like to know is why the 3rd argument in the pthread_create function which is my SendMessage function needs to be typecasted to a void pointer and then send the address of the function. Also as for the 4th argument, I would see typecasting to void pointer in some of the pthread examples I saw online, but in my case I'm passing a char pointer, would this be correct? In which case would I ever want to pass a void pointer?
Do I need a pthread_exit(NULL) in my main and in the SendMessage function? If so, why? I added the sleep() function so that I could let the pthread_exit function in my SendMessage function execute first. I simply saw that the online examples on pthread had pthread_exit() in both locations.
View 6 Replies
View Related
Jul 3, 2009
I am using openSUSE 10.3.When I install software from tarball then to record time required I send output of date to beg.txt(when installation begins) and end.txt (when installation finishes).How can I append output of date to a file so I don't need two files?
View 4 Replies
View Related
Feb 14, 2011
I wanted to find and replace a string from a perl file. I have written a script in bash which runs the following command.
perl -pi -e "s/$findstring/$replacestring/" testfile
where as $findstring = print F_WC_TMP"$line
";
and $replaceString = $line = join ' ', split ' ', $line; print F_WC_TMP"$line
";
But when I am running the above command, i think it is replacing the $findstring with the above mentioned string and hence it contains a $line, it is looking for the variable $line and not finding the exact string. I am confused about how to search for a string that contains $ in it and replace it with another $string.
View 5 Replies
View Related
May 17, 2011
I need to run a script that I build to build a word list. Essentially what it does is run through a base list and expands that into billions of words. This way I can keep a small dictionary file and a script to expand it into a larger file (about 500 gigs). This script should take anywhere from 12-14 days to run and on my last day the power went out at my house. Is there anyway I can run this again with a fail over system? I know a battery back up is an ideal addition to my home server but if the power is out for an hour it wouldn't have made a difference. Also if I had the ability to pause the script do a reboot and resume it again that would be amazing.
View 5 Replies
View Related
Aug 18, 2010
are there any commands to search your Mac using terminal? I tried usin grep to search but it seems somewhat unresponsive and nothing comes up.
For example, I would type "grep Files" (A folder name) and it just prints a blank line and nothing happens.
View 4 Replies
View Related
Jun 29, 2011
What folder[?] do I search to read for a USB drive (or any hard drive such as a partition) through the terminal?If you are asking why, I need to change the permission of this one folder. It was private, setting was 700 in UNIX I would like chmod to 755.You see, I'm browsing my laptop's hard drive that's mounted on a docking bay SATA to USB and I can't seem to browse one of my user's and I recall the permission setting was 700.nope, using the "Property -> Permission" method did not work.
View 5 Replies
View Related
Mar 7, 2011
I have a String that I would like to sign using a given RSA Private key. I thought this would be relatively easy but I have not been able to find out how to do it, unless I'm looking to far into a simple problem. Do i have to put the string into a file, and sign the file, or can i just sign the string/message?
View 7 Replies
View Related
Sep 2, 2010
I have a line in a text file that has 40 random characters within a tag and i want to change the characters to a new set of 40 random characters (alphanumeric a-z 0-9 etc)
The line in the text file looks like this:
Quote:
How would i go about doing that?
Also second question same as the above but how would i remove them instead of replacing them?
View 14 Replies
View Related
Jan 4, 2009
Im running samba on fedora core 7, im abit new to the server part of fedora, i set up samba and it runs well, only issue i have now is resolving permissions( User Rights)i have a shared folder which has alot of files and many subfolders in it, the files and folders in this shared foldr were copied from our old Novell Server through samba, i need to assign permissions to this folder where by a defined usergroup can have full read and write permissions to all the files and folders and sub-folders in the shared folder. i tried doing it in GUI but i realized there were over 1000 subfolders.is there a command i can run in the Terminal to help me assign the permissions?
View 1 Replies
View Related
Apr 26, 2011
If I have a word in a text file and I need to replace it by another word (for example, i need to replace abc by fff) so what is the command I can type it?
I am using vi editor.
View 3 Replies
View Related
Jul 12, 2010
Well i downloaded a program with many .deb files ( At least 15 ) so i wanna execute them all trough the terminal so i typed
Code:
patowlmc@patowlmc-desktop:~$ cd /home/patowlmc/Downloads/i386
patowlmc@patowlmc-desktop:~/Downloads/i386$ sudo dpkg -i *.deb
Readme.deb: command not found
As you can see all files in the folder are .deb packages, but one: The Readme file, wich is a text file.
I know I just have to move the file to somewhere else, and everything should work, but i wanna know if there's a command for excluding a file or something.
P.D. I totally trust the program, so don't worry about so many .deb files.
View 9 Replies
View Related
Mar 7, 2010
i use this script to get the time and date of back and fourth transactions for a particular execution id. I use a substr command on the 5th column to to cut the milli seconds off the time value. - otherwise the times would look like 08:30:04.235
grep <executionID> <auditfile> | awk '{ print $1, $2, $3, $4, substr($5,1,8}
FIX -> Mon 3/1/2010 08:30:04
FIX <- Mon 3/1/2010 08:32:36
FIX <- Mon 3/1/2010 08:35:08
[code].....
anyhow - i append two sed commands to further clarify the direction of the message.
awk '{ print $1, $2, $3, $4, substr($5,1,8} | sed -e 's/->/ ->IN/g' | sed -e 's/<-/<-OUT/g'
FIX -> IN Mon 3/1/2010 08:30:04
FIX <- OUT Mon 3/1/2010 08:32:36
[code]....
I tried using an awk gsub () command within the string instead of the two seds, but it did not work:
awk '{ print gsub(/<regex>/, <replace with>,$1), $2, $3, $4, substr($5,1,8}
the sed works ok, but it would be cooler to make the replacement within the awk command:
gsub(/->/,-> IN, $1)
Is there a way where i could replace the value of the $1 column in the awk print string?
View 1 Replies
View Related
Mar 20, 2010
How do I use my SSH Terminal to get a file that is sittng on another server that I have.. As its like 500 megs or so but to download it to my computer then upload it it takes a long time..
So this is what i have done so far
1. Loged in to SSH Terminal
2. Went to my DIR that i want to put the FILE to
3. Typed in FTP
4. I"M LOST now as i'm trying to connect using my user on my ftp site (DIFFERN"T SERVER)
I relly need the key commands SHH Terminal for dummies
View 3 Replies
View Related
Sep 28, 2010
I use webcam with the streamer application. So, to record a video I have to put in terminal something like this:
Code:
streamer -q -c /dev/video0 -f rgb24 -r 24 -t 00:30:00 -o /home/shark/untitled.avi
I know I can use other applications but I have got problems with all except with this. This is really annoying because it is a delay job. So, I am wondering how can I make a script that the terminal will ask me to name the file or even better to ask where to put my file.
View 9 Replies
View Related
Oct 13, 2010
I've got some photos with two or more tags on and I was wondering if there was a way of only showing photos that had one tag and not another. I've found a way of doing it with AND and OR (the default) but I really want to search, for example, all my 'holiday' photos that don't have any pictures of person 'X' in.
View 1 Replies
View Related
Dec 27, 2010
I'd like to know which command i should run from the terminal to know which file system (ext3, ext4, etc...) my Ubuntu runs on.
View 2 Replies
View Related
May 10, 2011
I've recently installed matlab and after some poking around found that you must start it using a script like:
#>> cd ~root/../matlab2009/bin/
#>>./matlab
the manual tells me that the installation should have made it so that all you have to do is type matlab at the terminal but for some reason this hasn't happened. If you did not set up symbolic links in the installation procedure, you must enter the full path name to start MATLAB, matlabroot/bin/matlab, where matlabroot is the name of the folder in which you installed MATLAB. I've also looked at documentation on ln but most refers to making links between files. Is there a way to link the command "matlab" to the file shown above so all I have to do is type the command and it runs the script?
p.s: Here's what I've tried:
#>> ln -s ~root/../matlab2009/bin/matlab matlab
linux-2fs6:/home/alex # matlab
If 'matlab' is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf matlab
View 9 Replies
View Related
Mar 13, 2011
I'm looking for a way to have the access log for my nginx install scroll up the terminal as lines are added to the log. I think I need a command like cat access.log | diff but I'm not sure exactly what it should be.
View 1 Replies
View Related
Nov 29, 2010
I have searched a lot in google regarding the various search commands available for linux, but everywhere i got the commands only for files. But suppose i know the name of a folder but not it's path, then what is the command to search for it's path.
View 10 Replies
View Related
Apr 23, 2011
is it possible to log the command output's history that are previously printed messages in the terminal to a file? that is the first command output when i first opened terminal through the last command.
View 5 Replies
View Related
Dec 16, 2010
my laptop seems to have a bad HDD, and I was thinking of trying to make it a "thin client." However since it is a laptop obviously I want to take it places. Is it possible to make a terminal server and "thin client" connect through the internet and not just LAN?The reason I quote thin client is because in my mind I am still going to need to use some HDD so I can connect to the internet and find my server.
To make things easier to read refer to the above as "question 1" and the velow as "question2" Thank you. And sorry for the inconvience. These topics I felt were to similar to make separate topics.I also have another question, the files I have on my server can be accessed by anyone on the network(added a second HDD and network shared it) how can I make it so that the LAN clients have to "login" (or it uses their computers login info to send them to only their files? And if that is possible can we expand it to allow me to use those logins through the internet?
View 1 Replies
View Related