Skip to main content

Making your work easy with linux command

To replace a string with a new string in all files within a Linux environment, you can use the sed command. Here's an example of the command:

find /path/to/directory -type f -exec sed -i 's/old_string/new_string/g' {} +

Let's break down the command:

find /path/to/directory: Specifies the directory path where you want to search for files. Replace /path/to/directory with the actual directory path.

-type f: Specifies that you are only interested in regular files (not directories or other file types).

-exec sed -i 's/old_string/new_string/g' {} +: Executes the sed command with the specified parameters. The s/old_string/new_string/g part is the sed substitution pattern where you replace old_string with new_string. The -i option ensures that the changes are made directly in the files.

Make sure to replace old_string with the string you want to replace and new_string with the new string you want to insert.

Running this command will search for all files within the specified directory and its subdirectories, replacing the old_string with the new_string in each file.

To display all lines below a particular string in Linux, you can use the grep command with the -A option and specify a large enough number to include all lines. Here's an example:


echo "Line 1 Line 2 Line 3 Line 4 Line 5 Line 6" | grep -A 9999 "Line 3"

This command will output:


Line 3 Line 4 Line 5 Line 6

egrep '^(SAPSYSTEM|INSTANCE_NAME|SAPGLOBALHOST|SAPLOCALHOST|SAPSYSTEMNAME|SAPSYSTEMNR|DIR_INSTANCE|DIR_HOME|DEFAULT_PROFILE|SAPPROFILE|SAPDATA_HOME|SAPTRANSHOME|DIR_EXECUTABLE|DIR_GLOBAL|DIR_HOME_LOG|DIR_HOME_WORK)=' /path/to/instance/profile


grep -E '^(DBHOST|DBNAME|DBSYSTEM|DBINSTANCE|DBUSER|DBPASSWORD|DBCONNECT|DBMS_TYPE|DBMS_HOST|DBMS_PORT|DBMS_SCHEMA|MSSOCN|DBSL_VENDOR|DBSL_CONNECT_STRING)=' /path/to/instance/profile



check the github link

Comments

You might find these interesting

8 Must-Know Questions About Object Store on SAP Business Technology Platform

What is the problem that Object Store solves ? Modern enterprise systems increasingly deal with massive volumes of unstructured data such as documents, logs, media files, and backups. Traditional relational databases are not optimized for such workloads. What is Object Store ? Object storage—commonly referred to as blob storage—addresses this gap by providing scalable, durable, and cost-efficient storage for unstructured data. Object storage is a storage architecture designed to manage unstructured data as discrete units called objects.  Each object consists of: Binary data (file content) : Image , File etc Metadata (descriptive attributes) : File size, Content type, Last modified timestamp, Storage class (hot, cool, archive) Unique identifier (key or URL) : unique path-like string used to locate a blob inside a bucket Unlike file systems or relational databases, object storage does not rely on hierarchical file structures or schemas. The SAP BTP Object Store service is a managed, ...