Sponsored Content
Top Forums Shell Programming and Scripting remove leading spaces from a line Post 302175703 by lijojoseph on Saturday 15th of March 2008 05:52:07 AM
Old 03-15-2008
remove leading spaces from a line

Hi friends

I need some help,

I have a file which looks as follows

TEMP 014637065 014637065 517502 517502 RTE
517502 517502 RTE
AWATER_TEST 12325 23563 588323 2323 5656 32385 23235635
ANOTHER_TEST 12 5433 FTHH 5653 833
TEST 123 123 3235 5353 353 53 35 353 535 3
YTERS GJK JKLS

when ever there is a leading space on line(here there is a space at the starting of line 2 and 6 which may not be visible in thread), I need to remove that and append to the previous line. This means I want an output file which looks like
TEMP 014637065 014637065 517502 517502 RTE 517502 517502 RTE
AWATER_TEST 12325 23563 588323 2323 5656 32385 23235635
ANOTHER_TEST 12 5433 FTHH 5653 833
TEST 123 123 3235 5353 353 53 35 353 535 3 YTERS GJK JKLS
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed over writes my original file (using sed to remove leading spaces)

Hello and thx for reading this I'm using sed to remove only the leading spaces in a file bash-280R# cat foofile some text some text some text some text some text bash-280R# bash-280R# sed 's/^ *//' foofile > foofile.use bash-280R# cat foofile.use some text some text some text... (6 Replies)
Discussion started by: laser
6 Replies

2. Shell Programming and Scripting

remove trailing and leading spaces using tr command

Dear All, can you please advice how do i remove trailing and leading spaces from a pipe-delimited file using "tr" command the below cmd, i tried removed all spaces tr -d ' '<s1.txt>s2.txt1 Many thx Suresh (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

3. Shell Programming and Scripting

Not able to remove leading spaces

Hi Experts, In a file tht i copied from the web , i am not able to remove the leading white spaces. I tried the below , none of them working . I opened the file through vi to check for the special characters if any , but no such characters found. Your advice will be greatly appreciated. sed... (5 Replies)
Discussion started by: panyam
5 Replies

4. Shell Programming and Scripting

how to remove leading directory from line in filename?

i have a process that receives files similar to below. these are files obviously generated on a windows machine that are submitted to a linux cluster. the one thing they have in common is the leading c:\any-number-of-leading-dirs\filename.xxx. is there a way to re-create/modify the file to remove... (3 Replies)
Discussion started by: crimso
3 Replies

5. OS X (Apple)

Remove leading spaces from file names and folders

Hi All, I have a vexing issue with leading spaces in file names. Basically, we're moving tons of data from our ancient afp file share to Box.com and Box forbids leading spaces in files or folders. The HFS file system seems to be perfectly fine with this, but almost all other Unix file systems... (1 Reply)
Discussion started by: prometheon123
1 Replies

6. Shell Programming and Scripting

How Select numbers from a line of text, and remove leading spaces?

I have a text file with a line of text that contains numbers and text formatted into groups. I need to extract the number that can be either 1,2 or 3 digits long. Then write it to a variable, but i need to remove any leading spaces in the number first. I can get the numbers out but how to remove... (12 Replies)
Discussion started by: kcpoole
12 Replies

7. UNIX for Beginners Questions & Answers

How do I remove leading spaces in UNIX when count of space character is not fixed? Example below-

Script showStreamsGLIS$reg.$env.ksh gives me output as below- Job Stime Etime Status ExitCode GLIS-AS-S-EFL-LOCK-B ----- ----- OI 103313880/0 GLIS-ALL-Q-EOD-FX-UPDT-1730-B ----- ----- TE 0/0 GLIS-TK-S-BWSOD-B ... (8 Replies)
Discussion started by: Tanu
8 Replies

8. Shell Programming and Scripting

Remove leading and trailing spaces from a file

Hi, I am trying to remove leading and trailing spaces from a file using awk but somehow I have not been able to do it. Here is the data that I want to trim. 07/12/2017 15:55:00 |entinfdev |AD ping Time ms | .474| 1.41| .581|green |flat... (9 Replies)
Discussion started by: svajhala
9 Replies

9. Shell Programming and Scripting

Trying to remove leading spaces

OS : RHEL 6.7 Shell : bash I am trying to remove the leading the spaces in the below file $ cat pattern2.txt hello1 hello2 hello3 hello4 Expected output is shown below. $ cat pattern2.txt hello1 hello2 hello3 hello4 (2 Replies)
Discussion started by: John K
2 Replies

10. Shell Programming and Scripting

How to remove leading and trailing spaces for variable in shell script?

Hi I have variable named tablename. The value to tablename variable has leading and trailing white spaces. How to remove the leading and training white spaces and write the value of the tablename without space to a file using shell script. ( for e.g. tablename= yyy ) INPUT ... (10 Replies)
Discussion started by: pottic
10 Replies
lldptool(8)							       Linux							       lldptool(8)

NAME
evb - Show / manipulate EVB TLV configuration SYNOPSIS
lldptool -t -i ethx -V evbCfg -c enableTx lldptool -T -i ethx -V evbCfg -c enableTx=[yes|no] lldptool -t -i ethx -V evbCfg -c fmode lldptool -T -i ethx -V evbCfg -c fmode=[bridge|reflectiverelay] lldptool -t -i ethx -V evbCfg -c capabilities lldptool -T -i ethx -V evbCfg -c capabilities=[rte|ecp|vdp|none] lldptool -t -i ethx -V evbCfg -c rte lldptool -T -i ethx -V evbCfg -c rte=[<rte>] lldptool -t -i ethx -V evbCfg -c vsis lldptool -T -i ethx -V evbCfg -c vsis=[<number of vsis>] DESCRIPTION
The EVB TLV is a TLV to announce the station and bridge's edge virtual bridging (evb) capabilities and request the bridge forwarding mode. If both sides have agree on edge control protocol (ECP), VSI discovery protocol (VDP) capabilities, both sides can exchange VDP TLV using ECP frames. The vsis parameter will set the maximum number of VSIs and show the number of currently configured VSIs. ARGUMENTS
enableTx Enables the EVB TLV to be transmitted fmode shows or sets the forwarding mode between bridge (default) or reflectiverelay (RR). capabilities shows or sets the local capabilities that are announced to the adjacent switch in the TLV. This parameter will accept any combina- tion of rte, vdp or ecp, separated by ",". Use the keyword "none" if you do not want to set any capabilities. rte shows or set the local run time exponent (RTE). The RTE will be used as the base for the timing of the ECP and VDP protocols. vsis shows or sets the number of virtual station interfaces (VSIs) that are announced to the adjacent switch in the TLV. This parameter expects a number between 0 and 65535. Theory of Operation The EVB TLV is used to announce and exchange supported parameters between the station and an adjacent switch. If "reflectiverelay" is set as forwarding mode, the switch will allow "reflection" of frames coming from different sources at the same port back to the port. This will allow communication between virtual machines on the same host via the switch. The capabilities parameter is used to set RTE, ECP and VDP support. VDP TLVs in ECP frames can only be exchanged if both sides agree on ECP and VDP as capabilities. RTE will be used as the base timing parameter for ECP and VDP. EXAMPLE &; USAGE Display locally configured values for eth8 lldptool -t -i eth8 -V evbCfg Display remotely configured values for eth8 lldptool -n -t -i eth8 -V evbCfg Display wether evb tlv is configured for tx on eth8 lldptool -t -i eth8 -V evbCfg -c enableTx Display the currently requested forwarding mode for eth8 lldptool -t -i eth8 -V evbCfg -c fmode Set the forwarding mode to reflective relay lldptool -T -i eth8 -V evbCfg -c fmode=reflectiverelay Display the currently configured capabilities lldptool -t -i ethx -V evbCfg -c capabilities Set the locally possible capabilities to RTE, ECP and VDP lldptool -T -i ethx -V evbCfg -c capabilities=rte,ecp,vdp Resets the locally possible capabilities to "none" lldptool -T -i ethx -V evbCfg -c capabilities=none Display the locally configured value for RTE lldptool -t -i ethx -V evbCfg -c rte Set the value for RTE lldptool -T -i ethx -V evbCfg -c rte=[<rte>] Display the configured maximum number of VSIs lldptool -t -i ethx -V evbCfg -c vsis Set the maximum number of VSIs lldptool -T -i ethx -V evbCfg -c vsis=[<number of vsis>] SOURCE
o IEEE 802.1Qbg (http://www.ieee802.org/1/pages/802.1bg.html) NOTES
Currently the code in lldpad reflects draft 0 of the upcoming standard. EVB TLVs on the wire can be decoded with wireshark > v1.6. SEE ALSO
lldptool-vdp(8), lldptool(8), lldpad(8) AUTHOR
Jens Osterkamp open-lldp February 2010 lldptool(8)
All times are GMT -4. The time now is 02:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy