Sponsored Content
Top Forums Shell Programming and Scripting Bash - sed - Remove first word from line which can begin eventually with blank Post 302941715 by jcdole on Monday 20th of April 2015 10:46:22 AM
Old 04-20-2015
Bash - sed - Remove first word from line which can begin eventually with blank

hello.
How to remove first word from line. The line may or may not start with blank.

Code:
NEW_PARAM1=$(magic-command "    -t --protocol=TCP  -P 12345-u root -h localhost ")
NEW_PARAM2=$(magic-command "-t --protocol=TCP  -P 12345 -u root -h localhost ")

I want NEW_PARAM1 equal to NEW_PARAM2 equal to "--protocol=TCP........"

I don't care the number of blank following the first word.
Code:
"-t --protocol=TCP" or "-t         --protocol=TCP"  or "   -t         --protocol=TCP"

is the same for me.
What is important is to remove the first word and keep the rest as is.

Any help is welcome
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed: delete regex line and next line if blank

Hi, I want to write a sed script which from batiato: batiato/giubbe: pip_b.2.txt pip_b.3.txt pip_b.3mmm.txt bennato: bennato/peterpan: 123.txt consoli: pip_a.12.txt daniele: (2 Replies)
Discussion started by: one71
2 Replies

2. Shell Programming and Scripting

Remove blank line - SED

HI, I have this list of apps like so: DivX Products.app DivX Support.app Uninstall DivX for Mac.app Build Applet.app SpringBoard.app Interface.app MobileAddressBook.app MobileSafari.app MobileSlideShow.app Preferences.app Install Flash Player 8 OSX.app Yap.app check_afp.app ... (10 Replies)
Discussion started by: pcwiz
10 Replies

3. Shell Programming and Scripting

BASH: Grepping/sedding/etc out part of a file... (from one word to 'blank' line)

I have a file that lists data about a system. It has a part that can look like: the errors I'm looking for with other errors: Alerts Password Incorrect Login Error Another Error Another Error 2 Other Info or, just the errors I need to parse for: Alerts Password Incorrect ... (9 Replies)
Discussion started by: elinenbe
9 Replies

4. Shell Programming and Scripting

Remove last blank line of file

I have a number of files (arranged in directories) which have last line blank, I am trying to synchronize my code with other env and due to this blank lines, all files error out as different although only difference is that of balnk line at end of file. Is there a way I can recursively... (2 Replies)
Discussion started by: ruchimca
2 Replies

5. UNIX for Dummies Questions & Answers

Question: Help need to remove blank line & sed: Couldn't re-allocate memory error.

I've shell script where i used the below command to take the line which contains patterns. sed -n "/$year 05:/,/$year 17:/p" trace.log | grep -f patterns.txt > output.log This was working fine for long time, but now a days this script is not working with and throwing error like sed:... (8 Replies)
Discussion started by: senthil.ak
8 Replies

6. Shell Programming and Scripting

awk or sed command to print specific string between word and blank space

My source is on each line 98.194.245.255 - - "GET /disp0201.php?poc=4060&roc=1&ps=R&ooc=13&mjv=6&mov=5&rel=5&bod=155&oxi=2&omj=5&ozn=1&dav=20&cd=&daz=&drc=&mo=&sid=&lang=EN&loc=JPN HTTP/1.1" 302 - "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR... (5 Replies)
Discussion started by: elamurugu
5 Replies

7. Shell Programming and Scripting

strange: sed and awk print at end instead of begin of line

Hi! I have a strange behaviour from sed and awk, but I'm not sure, if I'm doing something wrong: I have a list of words, where I want to add the following string at the end of each line: \;\;\;\;0\;1 I try like this: $ cat myfile | awk '{if ( $0 != "" ) print $0"\;\;\;\;0\;1"}' Result:... (5 Replies)
Discussion started by: regisl67
5 Replies

8. Shell Programming and Scripting

Delete lines containing and remove the blank line at the same time

Is there a way to delete a line containing something and the blank line at the same time? If you do this it leaves a blank line behind. sed '/yum/d' .bash_historyI know this works but I would think there would be a way to do it with one command sed '/yum/d' .bash_history | sed '/^$/d'In... (2 Replies)
Discussion started by: cokedude
2 Replies

9. Shell Programming and Scripting

How to remove blank line from a text file?

Hi All, I am creating a text file using perl. The first record I am writing as "$line" and all the other as "\n$line". At the end the file is having N number of lines. I am using this file for MLOAD (Teradata), which is reading N+1 lines in the file and failing.I am not able to find new line... (2 Replies)
Discussion started by: unankix
2 Replies

10. Shell Programming and Scripting

sed - remove begin of line up to the third and including occurence of character

hello. How to remove all characters in a line from first character ( a $ ) until and including the third occurrence of that character ( $ ). Any help is welcome. (10 Replies)
Discussion started by: jcdole
10 Replies
ar(5)								File Formats Manual							     ar(5)

Name
       ar - archive (library) file format

Syntax
       #include <ar.h>

Description
       The archive command, combines several files into one.  Archives are used mainly as libraries to be searched by the link-editor,

       A  file	produced  by has a magic string at the start, followed by the constituent files, each preceded by a file header.  The magic number
       and header layout as described in the include file are:
       #define ARMAG  "!<arch>
"
       #define SARMAG 8

       #define ARFMAG "`
"

       struct ar_hdr {
	       char   ar_name[16];
	       char   ar_date[12];
	       char   ar_uid[6];
	       char   ar_gid[6];
	       char   ar_mode[8];
	       char   ar_size[10];
	       char   ar_fmag[2];
       };

       The name is a blank-padded string.  The ar_fmag field contains ARFMAG to help verify the presence of a header.  The other fields are  left-
       adjusted, blank-padded numbers.	They are decimal except for ar_mode, which is octal.  The date is the modification date of the file at the
       time of its insertion into the archive.

       Each file begins on an even (0 mod 2) boundary; a new-line is inserted between files if necessary.  The size given reflects the actual size
       of the file exclusive of padding.

       Provisions are not made for empty areas in an archive file.

       The encoding of the header is portable across machines.	If an archive contains printable files, the archive itself is printable.

Restrictions
       A filename loses trailing blanks.  Most software dealing with archives takes an included blank as a name terminator.

See Also
       ar(1), ld(1), nm(1)

								       RISC								     ar(5)
All times are GMT -4. The time now is 05:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy