spliting a single line into multiple lines
Posted: 28 Apr 2018 01:17
hello to everyone ! its been years and forgot everything i learned there before.
but now i learn a basic android for theming status bar
and i want and stable scripts to make xml editing easy.
here is my sample intial content of status_bar.xml content
above content had 5 lines with many special characters.
and i want every line that has a word "android:..." (which preceded with one space ) to split into new line
example result of above will be the ff:
its now from 5 lines into 17 lines.
so needs scripts to search for "android:" that preceded only with <one space char>
after spliting a preceding space will be remove and repace with a tab (single space only)
and here is the script i use from google:
result above is
other script i use is:
the result from using jreply is:
i had hard time recalling of what i learned before to apply above problem but seem returned back as a newbie again
hoping for some to help my scripts.
bars
but now i learn a basic android for theming status bar
and i want and stable scripts to make xml editing easy.
here is my sample intial content of status_bar.xml content
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.phone.PhoneStatusBarView android:orientation="vertical" android:id="@id/status_bar" android:background="@drawable/system_bar_background" android:focusable="true" android:descendantFocusability="afterDescendants"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
<ImageView android:id="@id/notification_lights_out" android:paddingBottom="2.0dip" android:visibility="gone" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:paddingStart="6.0dip" />
above content had 5 lines with many special characters.
and i want every line that has a word "android:..." (which preceded with one space ) to split into new line
example result of above will be the ff:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.phone.PhoneStatusBarView
android:orientation="vertical"
android:id="@id/status_bar"
android:background="@drawable/system_bar_background"
android:focusable="true"
android:descendantFocusability="afterDescendants"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
<ImageView android:id="@id/notification_lights_out"
android:paddingBottom="2.0dip"
android:visibility="gone"
android:layout_width="@dimen/status_bar_icon_size"
android:layout_height="fill_parent"
android:src="@drawable/ic_sysbar_lights_out_dot_small"
android:scaleType="center"
android:paddingStart="6.0dip" />
its now from 5 lines into 17 lines.
so needs scripts to search for "android:" that preceded only with <one space char>
after spliting a preceding space will be remove and repace with a tab (single space only)
and here is the script i use from google:
Code: Select all
@echo off
>newfile.txt (
for /f "delims=" %%A in (files.txt) do for %%B in (%%A) do echo %%B
)
PAUSE
EXIT
result above is
Code: Select all
version
"1.0"
encoding
<com.android.systemui.statusbar.phone.PhoneStatusBarView
android:orientation
"vertical"
android:id
"@id/status_bar"
android:background
"@drawable/system_bar_background"
android:focusable
"true"
android:descendantFocusability
"afterDescendants"
xmlns:android
"http://schemas.android.com/apk/res/android"
xmlns:systemui
"http://schemas.android.com/apk/res/com.android.systemui">
<ImageView
android:id
"@id/notification_lights_out"
android:paddingBottom
"2.0dip"
android:visibility
"gone"
android:layout_width
"@dimen/status_bar_icon_size"
android:layout_height
"fill_parent"
android:src
"@drawable/ic_sysbar_lights_out_dot_small"
android:scaleType
"center"
android:paddingStart
"6.0dip"
/>
other script i use is:
Code: Select all
jrepl "\q.*?\q" $0 /x /jmatch /f files.txt /o newfile2.txt
the result from using jreply is:
Code: Select all
"1.0"
"utf-8"
"vertical"
"@id/status_bar"
"@drawable/system_bar_background"
"true"
"afterDescendants"
"http://schemas.android.com/apk/res/android"
"http://schemas.android.com/apk/res/com.android.systemui"
"@id/notification_lights_out"
"2.0dip"
"gone"
"@dimen/status_bar_icon_size"
"fill_parent"
"@drawable/ic_sysbar_lights_out_dot_small"
"center"
"6.0dip"
i had hard time recalling of what i learned before to apply above problem but seem returned back as a newbie again
hoping for some to help my scripts.
bars