Grep 从文本文件中剪切一堆单词

Grep 从文本文件中剪切一堆单词,grep,cut,Grep,Cut,我正在尝试从800行中获取最后一部分,并使用bash将其保存到新文件中: 示例 framework/resources/Functional/tpcds/variants/json/q3_1.sql metastore/scripts/upgrade/derby/hive-schema-1.3.0.derby.sql coeus-db/coeus-db-sql/src/main/resources/co/kuali/coeus/data/migration/sql/mysql/rice_serv

我正在尝试从800行中获取最后一部分,并使用bash将其保存到新文件中:

示例

framework/resources/Functional/tpcds/variants/json/q3_1.sql
metastore/scripts/upgrade/derby/hive-schema-1.3.0.derby.sql
coeus-db/coeus-db-sql/src/main/resources/co/kuali/coeus/data/migration/sql/mysql/rice_server/bootstrap/V400_002__KR_RICE_01_1.0.3.2-2.0.0_2010-04-15_B000.sql
sql/Updates/0.0.3/r1358_mangos.sql
coeus-db/coeus-db-sql/src/main/resources/co/kuali/coeus/data/migration/sql/mysql/kc/bootstrap/V521_047__KC_DML_01_KRACOEUS-7036_B000.sql
src/FrontEnd/db/1.x/1.1/src/02.functions-and-logic/office/office.get_office_name_by_id.sql
q3_1.sql
hive-schema-1.3.0.derby.sql
V521_047__KC_DML_01_KRACOEUS-7036_B000.sql
V400_002__KR_RICE_01_1.0.3.2-2.0.0_2010-04-15_B000.sql
V521_047__KC_DML_01_KRACOEUS-7036_B000.sql
office.get_office_name_by_id.sql
我希望输出像

framework/resources/Functional/tpcds/variants/json/q3_1.sql
metastore/scripts/upgrade/derby/hive-schema-1.3.0.derby.sql
coeus-db/coeus-db-sql/src/main/resources/co/kuali/coeus/data/migration/sql/mysql/rice_server/bootstrap/V400_002__KR_RICE_01_1.0.3.2-2.0.0_2010-04-15_B000.sql
sql/Updates/0.0.3/r1358_mangos.sql
coeus-db/coeus-db-sql/src/main/resources/co/kuali/coeus/data/migration/sql/mysql/kc/bootstrap/V521_047__KC_DML_01_KRACOEUS-7036_B000.sql
src/FrontEnd/db/1.x/1.1/src/02.functions-and-logic/office/office.get_office_name_by_id.sql
q3_1.sql
hive-schema-1.3.0.derby.sql
V521_047__KC_DML_01_KRACOEUS-7036_B000.sql
V400_002__KR_RICE_01_1.0.3.2-2.0.0_2010-04-15_B000.sql
V521_047__KC_DML_01_KRACOEUS-7036_B000.sql
office.get_office_name_by_id.sql

有人能告诉我如何使用cut/grep命令实现它吗?

我建议使用以下AWK命令:
AWK'BEGIN{FS=“/”}{print$NF}

这是否回答了您的问题?我没有看到这个问题与PHP无关。。还是有可能给你一个主意!