shell 多行合并 或多行提取
各位大佬,目前有类似这样的文件:import 和from 可能在一行,也可能不在一行,是多行
import React, {Component} from 'react';
import {
Platform,
StyleSheet,
Text,
View,
FlatList,
TouchableHighlight,
DeviceEventEmitter,
Animated,
BackHandler
} from 'react-native';
import {
UPTrackEvent
} from' up-rn-base/action/UPModules'
import {
kkjhhhhh,
jhhjjhhhh,
kkkkkk
} from 'up-rn-base/action/UPModules'
import {oooooo} from 'up-rn-base/action/UPModules'
import {ppppp} from 'up-rn-base/action/UPModules'
import OrderBar from '../views/OrderBar'
import OrderList from '../views/OrderList'
import OrderUtils from '../views/OrderUtils'
import ViewLoading from "up-rn-base/views/LoadingComponent"
import FailureComponent from "up-rn-base/views/FailureComponent"
import UPReactTitle from 'up-rn-base/views/UPNativeTitle'
import RNText from 'up-rn-base/component/UPWRNText'
import UPMultiLanguageConfig from '../config/UPMultiLanguageConfig'
let dimensions = require("Dimensions");
let {width, height} = dimensions.get("window");
const BAR_HEIGHT = 42;
export default class List extends Component {
我想提取出from后是up-rn-base路径及对应的import 和from 之间的内容,最后提取的结果类似这样:
UPTrackEvent up-rn-base/action/UPModules
kkjhhhhh up-rn-base/action/UPModules
jhhjjhhhh up-rn-base/action/UPModules
kkkkkk up-rn-base/action/UPModules
oooooo up-rn-base/action/UPModules
ppppp up-rn-base/action/UPModules
ViewLoading up-rn-base/views/LoadingComponent
FailureComponent up-rn-base/views/FailureComponent
UPReactTitle up-rn-base/views/UPNativeTitle
RNText up-rn-base/component/UPWRNText
目前用了
awk '/import/,/from/{print $0}'
只能到这个结果:
import {
Platform,
StyleSheet,
Text,
View,
FlatList,
TouchableHighlight,
DeviceEventEmitter,
Animated,
BackHandler
} from 'react-native';
import {
UPTrackEvent
} from' up-rn-base/action/UPModules'
import {
kkjhhhhh,
jhhjjhhhh,
kkkkkk
} from 'up-rn-base/action/UPModules'
import {oooooo} from 'up-rn-base/action/UPModules'
import {ppppp} from 'up-rn-base/action/UPModules'
import OrderBar from '../views/OrderBar'
import OrderList from '../views/OrderList'
import OrderUtils from '../views/OrderUtils'
import ViewLoading from "up-rn-base/views/LoadingComponent"
import FailureComponent from "up-rn-base/views/FailureComponent"
import UPReactTitle from 'up-rn-base/views/UPNativeTitle'
import RNText from 'up-rn-base/component/UPWRNText'
import UPMultiLanguageConfig from '../config/UPMultiLanguageConfig'
网上搜了,及看了多行匹配相关的内容,还是搞不出来。
目前想着把相邻的import from 整成一行再提取。
恳请大佬,根据关键字对行合并成一行怎么写呢,或者怎么能的呆我想要的结果呢。非常感谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论