Sponsored Content
Full Discussion: Triming a string
Top Forums Shell Programming and Scripting Triming a string Post 302564643 by CarloM on Friday 14th of October 2011 08:39:24 AM
Old 10-14-2011
Try
Code:
# awk -F'\' '/load/ {print $2}' FILE_NAME
fiosapp
fiosapp
fiosapp

EDIT: But I get that output even with your supplied command. What does the output of your grep command look like? What shell are you using?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Triming spaces for any variable

Hi, I want to trim the spaces on left side of the variable value. For eg: if it is 4 spaces followed by value, All the spaces on the left should be supressed. Easy but want it quickly. Regards, Shiv@jad (6 Replies)
Discussion started by: Shiv@jad
6 Replies

2. Shell Programming and Scripting

search string in a file and retrieve 10 lines including string line

Hi Guys, I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same. can anyone of you please let me know how to go about it ? (8 Replies)
Discussion started by: sukrish
8 Replies

3. Shell Programming and Scripting

Putting two perl scripts together... triming whitespace off of recently parsed file

Thanks to people's help, I have composed a single line within a .sh script that Ports a file into a csv: perl -p -i -e... (5 Replies)
Discussion started by: Astrocloud
5 Replies

4. Shell Programming and Scripting

to extract string from main string and string comparison

continuing from my previous post, whose link is given below as a reference https://www.unix.com/shell-programming-scripting/171076-shell-scripting.html#post302573569 consider there is create table commands in a file for eg: CREATE TABLE `Blahblahblah` ( `id` int(11) NOT NULL... (2 Replies)
Discussion started by: vivek d r
2 Replies

5. Shell Programming and Scripting

Triming spaces few columns

File contains 10 columns,i want trim the 2,4,10 columns using single unix command. Please suggest me how to do? Thanks (21 Replies)
Discussion started by: bmk
21 Replies

6. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

7. Shell Programming and Scripting

grep exact string from files and write to filename when string present in file

I am attempting to grep an exact string from a series of files within a directory and append that output to the filename when it is present in the file. I've been after this all day with no luck. Thanks for your help in advance :wall:. (4 Replies)
Discussion started by: JC_1
4 Replies

8. Shell Programming and Scripting

Remove lines between the start string and end string including start and end string Python

Hi, I am trying to remove lines once a string is found till another string is found including the start string and end string. I want to basically grab all the lines starting with color (closing bracket). PS: The line after the closing bracket for color could be anything (currently 'more').... (1 Reply)
Discussion started by: Dabheeruz
1 Replies

9. UNIX for Beginners Questions & Answers

Search a string and display its location on the entire string and make a text file

I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file. Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies

10. UNIX for Beginners Questions & Answers

Triming the data in a file.

Hi, I have a big csv file with below data. file: La Cage Aux Folles (Widescreen) Famous Mystics and Psychics A Passion for Planning Financials Operations Marketing Management and Ethics Precious Moments Holy Bible New King James Version Precious Angels Edition Blue Practical Recording... (9 Replies)
Discussion started by: Raghuram717
9 Replies
SLSH(1) 																   SLSH(1)

NAME
slsh - Interpreter for S-Lang scripts SYNOPSIS
slsh [ --help ] [ --version ] [ -g ] [ -n ] [ --init file ] [ --no-readline ] [ -i ] [ -t ] [ -v ] [ -|script-file args... ] DESCRIPTION
slsh is a simple program for interpreting S-Lang scripts. It supports dynamic loading of S-Lang modules and includes a readline interface for interactive use. OPTIONS
--help Show a summary of options --version Show slsh version information -g Compile with debugging code, tracebacks, etc -n Don't load the personal initialization file --init file Use this file instead of ~/.slshrc --no-readline Do not use a readline interface for the interactive mode -i Force interactive mode. Normally slsh will go into interactive mode if both stdin and stdout are attached to a terminal. -t Normally, slsh will call slsh_main if it is defined. This option prevents that from happening making it useful for checking for syntax error. -v Show verbose loading messages. This is useful for seeing what files are being loaded. INITIALIZATION
Upon startup, the program will try to load slsh.rc as follows. If either SLSH_CONF_DIR or SLSH_LIB_DIR environment variables exist, then slsh will look look in the corresponding directories for slsh.rc. Otherwise it will look in: $(prefix)/etc/ (as specified in the Makefile) /usr/local/etc/ /usr/local/etc/slsh/ /etc/ /etc/slsh/ The slsh.rc file may load other files from slsh's library directory in the manner described below. Once slsh.rc has been loaded, slsh will load $HOME/.slshrc if present. Finally, it will load the script specified on the command line. If the name of the script is -, then it will be read from stdin. If the script name is not present, slsh will go into interactive mode and read input from the terminal. If the script is present and defines a function called slsh_main, that function will be called. LOADING FILES
When a script loads a file via the built-in evalfile function or the require function (autoloaded by slsh.rc), the file is searched for along the SLSH_PATH as specified in the Makefile. An alternate path may be specified by the SLSH_PATH environment variable. The search path may be queried and set during run time via the get_slang_load_path and set_slang_load_path functions, e.g., set_slang_load_path ("/home/bill/lib/slsh:/usr/share/slsh"); INTERACTIVE MODE
When slsh is invoked without a script or is given the -i command line argument, it will go into into interactive mode. In this mode, the user will be prompted for input. The program will leave this mode and exit if it sees an EOF (Ctrl-D) or the user exits by issuing the quit command. If an uncaught exception occurs during execution of a command, the error message will be shown and the user will be prompted for more input. Any objects left on the stack after a command will be printed and the stack cleared. This makes interactive mode useful as a calculator, e.g., slsh> 3*10; 30 slsh> x = [1:20]; slsh> sum (sin(x)-cos(x)); 0.458613 slsh> quit; Note that in this mode, variables are automatically declared. The interactive mode also supports command logging. Logging is enabled by the start_log function. The stop_log function will turn off logging. The default file where logging information will be written is slsh.log. An alternative may be specified as an optional argument to the start_log function: slsh> start_log; Logging input to slsh.log . . slsh> stop_log; slsh> start_log("foo.log"); Logging input to foo.log . . slsh> stop_log; slsh> start_log; Logging input to foo.log Similarly, the save_input function may be used to save the previous input to a specified file: slsh> save_input; Input saved to slsh.log slsh> save_input ("foo.log"); Input saved to foo.log As the above examples indicate, lines must end in a semicolon. This is a basic feature of the language and permits commands to span multi- ple lines, e.g., slsh> x = [ 1,2,3, 4,5,6]; slsh> sum(x); For convenience some users prefer that commands be automatically terminated with a semicolon. To have a semicolon silently appended to the end of an input line, put the following in $HOME/.slshrc file: #ifdef __INTERACTIVE__ slsh_append_semicolon (1); #endif The interactive mode also supports shell escapes. To pass a command to the shell, prefix it with !, e.g., slsh> !pwd /grandpa/d1/src/slang2/slsh slsh> !cd doc/tm slsh> !pwd /grandpa/d1/src/slang2/slsh/doc/tm Finally, the interactive mode supports a help and apropos function: slsh> apropos list apropos list ==> List_Type list_append list_delete . . slsh> help list_append list_append SYNOPSIS Append an object to a list USAGE list_append (List_Type, object, Int_Type nth) . . For convenience, the help and apropos functions do not require the syntactic constraints of the other functions. MISCELLANEOUS SCRIPTS
Several useful example scripts are located in $prefix/share/slsh/scripts/, where $prefix represents the slsh installation prefix (/usr, /usr/local,...). These scripts include: sldb A script that runs the S-Lang debugger. jpegsize Reports the size of a jpeg file. svnsh A shell for browsing an SVN repository. AUTHOR
The principal author of slsh is John E. Davis <jed@jedsoft.org>. The interactive mode was provided by Mike Noble <mnoble@space.mit.edu>. The S-Lang library upon which slsh is based is primarily the work of John E. Davis with help from many others. This manual page was originally written by Rafael Laboissiere <rafael@debian.org> for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL 06 May 2006 SLSH(1)
All times are GMT -4. The time now is 08:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy