The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
2answers
37 views

How to report filenames found by strings after being piped through grep?

I've been around *nix long enough to remember having done this in the past, and now those neural pathways are gone... I'm searching /usr/local/lib for files that contain img_convert because I'm ...
1
vote
1answer
284 views

How to reset a tcp connection immediately on both ends on a certain condition using linux netfilter/iptables?

Dear Serverfault community, I have the following problem: I need to reset (disconnect) tcp connections on both network sides immediately if a certain string is encountered in the packet data. I don't ...
3
votes
1answer
552 views

How to add an event/alert on Zenoss for a string type SNMP OID?

I have the status of a particular application being reported as string over SNMP. When everything is working as expected, that monitoring reports an empty string and when some of the data sources ...
4
votes
2answers
2k views

Lowercase variable values in Puppet

In my puppet config I need to lowercase a variable value before using it in a template. How to achieve this? Is there a way to lowercase a variable value inside the puppet manifest? Do I need to do ...
4
votes
5answers
4k views

How do I split a string against a character in BASH?

I would like to be able to split an authorization code by the - character so that I can operate on each segment individually. I do not want to use external binaries (awk, grep) - this is to be as ...
1
vote
2answers
325 views

Extract repository name from GitHub url in bash

Given ANY GitHub repository url string like: git://github.com/some-user/my-repo.git or git@github.com:some-user/my-repo.git or https://github.com/some-user/my-repo.git What is the best way in ...
0
votes
1answer
1k views

How to get lines that contain string in a file?

In Linux, How do I display lines that contain a string in a text file, such as: search "my string" file_name How do I make the search case sensitive/insensitive? And how do I also display the line ...
0
votes
1answer
42 views

filling up a file with a record with escaped chars

I have this record of a csv: "0258327469@pippo.it","456281438","16274","782981244047720"," ","<table cellpadding=""0"" cellspacing=""0"" border=""0"" width=""100%"" align=""center"" ...
5
votes
4answers
3k views

Linux shell command to filter a text file by line length

I have a 30gb disk image of a borked partition (think dd if=/dev/sda1 of=diskimage) that I need to recover some text files from. Data carving tools like foremost only work on files with well defined ...
0
votes
1answer
873 views

How to find a file that contains the specified string in FreeBSD?

I'm searching for the way to find a file that contains specified string text. It should be fast as possible but its not that important. I was reading the manual, and I've build something like that: ...
0
votes
3answers
262 views

portable unix way to join strings with separator

Is there a portable unix shellscripting way of joining a number of strings together with a given separator, like so: $ strjoin --- foo bar baz quux foo---bar---baz---quux Sure I could use a ...
2
votes
2answers
2k views

How do I get the last part of directory from a command line

How do I store the last part of directory in a variable? For example I have the following path: A\B\C\D, I want to store D in variable like file_name=D.
-1
votes
1answer
588 views

Mass search / replace string from ssh?

I am in the process of selling a network of 60 sites, they all have adsense with the same publisher id (google_ad_client="pub-xxxxxxxxxxxxxxxx") in all the files in the /home/ folder. How can I do a ...
0
votes
2answers
1k views

Allow connections to only a specific URL via HTTPS with iptables, -m recent (potentially) and -m string (definitely)

Let's say that, for example, I want to allow connections only to subdomain.mydomain.com; I have it partially working, but it sometimes gets in a freaky loop with the client key exchange once the ...
3
votes
4answers
756 views

How to extract hostname from $(who am i)

I try to extract the hostname from the following string (created using who am i): username pts/0 2010-10-05 17:30 (www.example.com) I need a solution which also works if (www.example.com) is ...
3
votes
1answer
159 views

problem with strings in script powershell sudo

im making a script like sudo, the idea is that the sudo function is going to run a scriptblock in elevation. I'm having trouble with the strings variables, that i pass in that scriptblock. Is like the ...
3
votes
5answers
218 views

Strip a single line out of many files

I am trying to remove a string from many text files on one of our servers. The string is identical across all these files and I can run: grep -r -l 'string' to get the file list but I am stuck ...
0
votes
1answer
2k views

How to replace text string in any type file(for example binary and …) and multiple files in linux?

I want to replace text string in any type file(for example perl,cgi,text,binary,js and ...) in multiple folder in linux. How do i do? Tanks.
3
votes
4answers
3k views

How to replace a text string in multiple files in Linux

There are a variety of ways to replace one string of text with another across many files. Here are a few ways: using sed and find: sed 's/oldstring/newstring/' "$1" > "$1".new && find ...
9
votes
4answers
8k views

Linux Command to find Strings in Binary or non ascii file

Is there any linux command to extracts all the ascii strings from an executable or other binary file? I suppose I could do it with a grep, but I remember hearing somewhere that such a command existed? ...