Questions tagged [strings]

31 questions
2
votes
1 answer

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.
M.Rezaei
  • 415
  • 4
  • 9
  • 19
2
votes
1 answer

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: grep my_string * -r and it works at all, but if…
Cyclone
  • 260
  • 1
  • 6
  • 20
2
votes
1 answer

Removing specific characters from a string on ansible

I have the following - set_fact: test_result: " {{ htmlres.content | regex_search('http://website([0-9]+)', '\\1') }}" Using debug, this returns the following " '[01]'" Wanting only the number, I did some experimenting using the replace()…
Ress
  • 45
  • 1
  • 2
  • 8
1
vote
1 answer

How to drop outgoing traffic based on matching string over HTTPS

I am managing a small shared hosting server. Today I received a complaint from my hosting provider that my server is sending out requests on wp-login.php pages of other websites elsewhere. I implemented the firewall rule /sbin/iptables -I OUTPUT -p…
John
  • 15
  • 3
1
vote
2 answers

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 getting a link error and want to find the library to…
Alan
  • 541
  • 1
  • 6
  • 20
1
vote
0 answers

BASH: No Such File or directory when comparing Strings

I am trying to create a script to compare an inputted string to an empty value. The logic works, but I keep receiving the following error: ./demo.sh: line 13: [[/var: No such file or directory Here is the code block that I am struggling with: read…
Reboot
  • 11
  • 2
0
votes
1 answer

Grepping a single line from iftop

iftop -t -L1 -s1 Output: iftop -t -L1 -s1 | grep "Total send and receive rate:" Output: How can I grep just the "Total send and receive state:" line?
JustAGuy
  • 639
  • 3
  • 23
  • 38
0
votes
1 answer

How to whitelist User Agent string?

I'm trying to whitelist a very specific User Agent string in Nginx. The below examples demonstrate how to whitelist general types of browsers (eg mozilla or chrome), but the string I want to whitelist has / and ( which breaks the nginx conf. How to…
user421936
  • 241
  • 1
  • 3
  • 4
0
votes
1 answer

How to remove string and replace with content found in text file using batch script or powershell

How to remove string and replace with content found in text file using batch script. test.txt Version: 4.5.0 Import: //MPackages/Project/config/abc.txt #head //Packages/Project/config/cde.txt …
tipu
  • 3
  • 2
0
votes
1 answer

filling up a file with a record with escaped chars

I have this record of a csv: "0258327469@pippo.it","456281438","16274","782981244047720"," ","","","","","","" I need to fill a file…
dierre
  • 145
  • 1
  • 6
0
votes
2 answers

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 Client Hello is allowed. Ah, to make it even more…
The Consumer
  • 1
  • 1
  • 3
0
votes
1 answer

convert strings from mixed to upper case in windows batch scripting

Is there a way to convert strings from mixed to upper case in windows batch scripting? I am writing a batch file to create certain objects and grant user groups access to them. That is, I should issue commands like cas caslibs create path --name…
Dirk Horsten
  • 97
  • 1
  • 4
0
votes
0 answers

Split variable $name NGINX server (rtmp-module)

I need to split the $name variable from my nginx conf file. I got a $name that is something like "12345_stream". I need to split this and use the part before "_" (12345) inside the execution to puth the value 12345 inside the FFMPEG execution and…
tidpe
  • 201
  • 3
  • 12
0
votes
1 answer

Variables covered in b' ' in Python 3

I am sure this is a fairly noob question, I have googled, and cannot find a straight answer, but I may be asking the wrong thing... I am trying to make an Out Of Box Configuration script, and all the questions that need answered are stored in a…
-2
votes
1 answer

How to cut a string after a number of characters in unix?

How to delete all characters in one line after point with with sed? I have a file with multiple lines like this: 123456789 3483 98765432 56345 985745634 3469 67495735 87654 Now I want to delete all after the first 10 characters. So I only want my…
TCP
  • 11
  • 1
  • 1
  • 1